laura is hosted by Hepforge, IPPP Durham
Laura++  v3r1
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, UInt_t nExpt, UInt_t firstExpt=0, Bool_t useAsymmErrors=kFALSE, Bool_t twoStageFit=kFALSE)
 Run the fit. More...
 
virtual void withinAsymErrorCalc (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...
 
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...
 
- Public Member Functions inherited from LauFitObject
virtual ~LauFitObject ()
 Destructor. 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 (Bool_t useAsymmErrors, Bool_t twoStageFit)
 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...
 

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...
 
UInt_t nParams_
 The number of fit parameters. More...
 
UInt_t nFreeParams_
 The number of free fit parameters. More...
 
Bool_t withinAsymErrorCalc_
 Flag to indicate if the asymmetric error calculation (e.g. MINOS) is currently running. More...
 
UInt_t numberOKFits_
 The number of successful fits. More...
 
UInt_t numberBadFits_
 The number of fit failures. More...
 
Int_t fitStatus_
 The status of the current fit. More...
 
UInt_t iExpt_
 The experiment number of the current fit. More...
 
Double_t NLL_
 The negative log-likelihood. More...
 
TMatrixD covMatrix_
 The fit covariance matrix. 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 39 of file LauSimFitMaster.cc.

LauSimFitMaster::~LauSimFitMaster ( )
virtual

Destructor.

Definition at line 60 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 745 of file LauSimFitMaster.cc.

void LauSimFitMaster::addConstraint ( const TString &  formula,
const std::vector< TString > &  pars,
const Double_t  mean,
const Double_t  width 
)
virtual

Store constraint information for fit parameters.

Parameters
[in]formulathe formula to be used in the LauFormulaPar
[in]parsa vector of LauParameter names to be used in the Formula, in the order specified by the formula
[in]meanthe value of the mean of the Gaussian constraint
[in]widththe value of the width of the Gaussian constraint

Implements LauFitObject.

Definition at line 735 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 541 of file LauSimFitMaster.cc.

void LauSimFitMaster::checkInitFitParams ( )
protected

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

Definition at line 584 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 393 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 788 of file LauSimFitMaster.cc.

void LauSimFitMaster::fitExpt ( Bool_t  useAsymmErrors,
Bool_t  twoStageFit 
)
protected

Perform the fit for the current experiment.

Definition at line 590 of file LauSimFitMaster.cc.

Double_t LauSimFitMaster::getLogLikelihoodPenalty ( )
protected

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

Definition at line 719 of file LauSimFitMaster.cc.

void LauSimFitMaster::getParametersFromSlaves ( )
protected

Determine/update the parameter initial values from all slaves.

Definition at line 206 of file LauSimFitMaster.cc.

void LauSimFitMaster::getParametersFromSlavesFirstTime ( )
protected

Determine the parameter names and initial values from all slaves.

Definition at line 293 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 669 of file LauSimFitMaster.cc.

void LauSimFitMaster::initialise ( )
protected

Initialise.

Definition at line 418 of file LauSimFitMaster.cc.

void LauSimFitMaster::initSockets ( )
protected

Initialise socket connections for the slaves.

Definition at line 105 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 370 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 495 of file LauSimFitMaster.cc.

void LauSimFitMaster::runSimFit ( const TString &  fitNtupleFileName,
UInt_t  nExpt,
UInt_t  firstExpt = 0,
Bool_t  useAsymmErrors = kFALSE,
Bool_t  twoStageFit = kFALSE 
)

Run the fit.

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

Definition at line 423 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 640 of file LauSimFitMaster.cc.

void LauSimFitMaster::updateParametersFromSlaves ( )
protected

Update and verify the parameter initial values from all slaves.

Definition at line 223 of file LauSimFitMaster.cc.

virtual void LauSimFitMaster::withinAsymErrorCalc ( Bool_t  inAsymErrCalc)
inlinevirtual

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

Implements LauFitObject.

Definition at line 75 of file LauSimFitMaster.hh.

Bool_t LauSimFitMaster::writeOutResults ( )
protected

Instruct the slaves to write out the fit results.

Definition at line 953 of file LauSimFitMaster.cc.

Member Data Documentation

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

Gaussian constraints.

Definition at line 224 of file LauSimFitMaster.hh.

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

The covariance sub-matrices for each slave.

Definition at line 200 of file LauSimFitMaster.hh.

TMatrixD LauSimFitMaster::covMatrix_
private

The fit covariance matrix.

Definition at line 197 of file LauSimFitMaster.hh.

TStopwatch LauSimFitMaster::cumulTimer_
private

The total fit timer.

Definition at line 245 of file LauSimFitMaster.hh.

LauFitNtuple* LauSimFitMaster::fitNtuple_
private

The fit results ntuple.

Definition at line 248 of file LauSimFitMaster.hh.

Int_t LauSimFitMaster::fitStatus_
private

The status of the current fit.

Definition at line 188 of file LauSimFitMaster.hh.

UInt_t LauSimFitMaster::iExpt_
private

The experiment number of the current fit.

Definition at line 191 of file LauSimFitMaster.hh.

TMessage* LauSimFitMaster::messageFromSlave_
private

Message from slaves to the master.

Definition at line 212 of file LauSimFitMaster.hh.

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

Messages to slaves.

Definition at line 209 of file LauSimFitMaster.hh.

UInt_t LauSimFitMaster::nFreeParams_
private

The number of free fit parameters.

Definition at line 176 of file LauSimFitMaster.hh.

Double_t LauSimFitMaster::NLL_
private

The negative log-likelihood.

Definition at line 194 of file LauSimFitMaster.hh.

UInt_t LauSimFitMaster::nParams_
private

The number of fit parameters.

Definition at line 173 of file LauSimFitMaster.hh.

const UInt_t LauSimFitMaster::nSlaves_
private

The number of slaves.

Definition at line 167 of file LauSimFitMaster.hh.

UInt_t LauSimFitMaster::numberBadFits_
private

The number of fit failures.

Definition at line 185 of file LauSimFitMaster.hh.

UInt_t LauSimFitMaster::numberOKFits_
private

The number of successful fits.

Definition at line 182 of file LauSimFitMaster.hh.

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

Parameters.

Definition at line 221 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 215 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 218 of file LauSimFitMaster.hh.

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

Parameter values.

Definition at line 227 of file LauSimFitMaster.hh.

const UInt_t LauSimFitMaster::reqPort_
private

The requested port.

Definition at line 170 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 233 of file LauSimFitMaster.hh.

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

Lists of indices for each slave.

Definition at line 230 of file LauSimFitMaster.hh.

TMonitor* LauSimFitMaster::socketMonitor_
private

Parallel setup monitor.

Definition at line 203 of file LauSimFitMaster.hh.

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

Sockets for each of the slaves.

Definition at line 206 of file LauSimFitMaster.hh.

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

Store the constraints for fit parameters until initialisation is complete.

Definition at line 164 of file LauSimFitMaster.hh.

TStopwatch LauSimFitMaster::timer_
private

The fit timer.

Definition at line 242 of file LauSimFitMaster.hh.

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

Parameter values to send to the slaves.

Definition at line 236 of file LauSimFitMaster.hh.

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

Likelihood values returned from the slaves.

Definition at line 239 of file LauSimFitMaster.hh.

Bool_t LauSimFitMaster::withinAsymErrorCalc_
private

Flag to indicate if the asymmetric error calculation (e.g. MINOS) is currently running.

Definition at line 179 of file LauSimFitMaster.hh.


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