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

The base class for any slave process for simultaneous/combined fits. More...

#include <LauSimFitSlave.hh>

Inheritance diagram for LauSimFitSlave:
LauFitObject LauAbsFitModel LauRooFitSlave LauCPFitModel LauSimpleFitModel

Public Member Functions

 LauSimFitSlave ()
 Constructor. More...
 
virtual ~LauSimFitSlave ()
 Destructor. More...
 
UInt_t nSlaves () const
 Obtain the number of slaves. More...
 
UInt_t slaveId () const
 Obtain the ID number of this slave. More...
 
virtual void runSlave (const TString &dataFileName, const TString &dataTreeName, const TString &histFileName, const TString &tableFileName="", const TString &addressMaster="localhost", const UInt_t portMaster=9090)
 Start the slave process for simultaneous fitting. More...
 
virtual void initialise ()=0
 Initialise the fit model. More...
 
virtual void setParsFromMinuit (Double_t *par, Int_t npar)=0
 This function sets the parameter values from Minuit. More...
 
virtual Double_t getTotNegLogLikelihood ()=0
 Calculates the total 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...
 
virtual void withinAsymErrorCalc (const Bool_t inAsymErrCalc)
 Mark that the fit is calculating asymmetric errors. 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

const LauFitNtuplefitNtuple () const
 Const access to the fit ntuple. More...
 
LauFitNtuplefitNtuple ()
 Access to the fit ntuple. More...
 
void connectToMaster (const TString &addressMaster, const UInt_t portMaster)
 Establish the connection to the master process. More...
 
void processMasterRequests ()
 Listen for requests from the master and act accordingly. More...
 
virtual void setupResultsOutputs (const TString &histFileName, const TString &tableFileName)
 Setup saving of fit results to ntuple/LaTeX table etc. More...
 
virtual void prepareInitialParArray (TObjArray &array)=0
 Package the initial fit parameters for transmission to the master. More...
 
virtual void finaliseExperiment (const LauAbsFitter::FitStatus &fitStat, const TObjArray *parsFromMaster, const TMatrixD *covMat, TObjArray &parsToMaster)=0
 Perform all finalisation actions. More...
 
virtual Bool_t verifyFitData (const TString &dataFileName, const TString &dataTreeName)=0
 Open the input file and verify that all required variables are present. More...
 
virtual UInt_t readExperimentData ()=0
 Read in the data for the current experiment. More...
 
virtual void cacheInputFitVars ()=0
 Cache the input data values to calculate the likelihood during the fit. More...
 
virtual void writeOutAllFitResults ()
 Write out any 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

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

Private Attributes

TSocket * sMaster_
 A socket to enable parallel setup. More...
 
TMessage * messageFromMaster_
 Message from master to the slaves. More...
 
UInt_t slaveId_
 Slave id number. More...
 
UInt_t nSlaves_
 The total number of slaves. More...
 
Double_t * parValues_
 Parameter values array (for reading from the master) More...
 
LauFitNtuplefitNtuple_
 The fit ntuple. More...
 

Detailed Description

The base class for any slave process for simultaneous/combined fits.

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

This class acts as the base class from which slaves should inherit. This allows any fitting framework to plug in to the JFit method.

Definition at line 37 of file LauSimFitSlave.hh.

Constructor & Destructor Documentation

LauSimFitSlave::LauSimFitSlave ( )

Constructor.

Definition at line 32 of file LauSimFitSlave.cc.

LauSimFitSlave::~LauSimFitSlave ( )
virtual

Destructor.

Definition at line 42 of file LauSimFitSlave.cc.

LauSimFitSlave::LauSimFitSlave ( const LauSimFitSlave rhs)
private

Copy constructor (not implemented)

Member Function Documentation

virtual void LauSimFitSlave::cacheInputFitVars ( )
protectedpure virtual

Cache the input data values to calculate the likelihood during the fit.

Implemented in LauAbsFitModel, LauCPFitModel, LauSimpleFitModel, and LauRooFitSlave.

LauSimFitSlave::ClassDef ( LauSimFitSlave  ,
 
)
private
void LauSimFitSlave::connectToMaster ( const TString &  addressMaster,
const UInt_t  portMaster 
)
protected

Establish the connection to the master process.

Parameters
[in]addressMasterthe hostname of the machine running the master process
[in]portMasterthe port number on which the master process is listening

Definition at line 94 of file LauSimFitSlave.cc.

virtual void LauSimFitSlave::finaliseExperiment ( const LauAbsFitter::FitStatus fitStat,
const TObjArray *  parsFromMaster,
const TMatrixD *  covMat,
TObjArray &  parsToMaster 
)
protectedpure virtual

Perform all finalisation actions.

  • Receive the results of the fit from the master
  • Perform any finalisation routines
  • Package the finalised fit parameters for transmission back to the master
Parameters
[in]fitStatthe status of the fit, e.g. status code, EDM, NLL
[in]parsFromMasterthe parameters at the fit minimum
[in]covMatthe fit covariance matrix
[out]parsToMasterthe array to be filled with the finalised LauParameter objects

Implemented in LauAbsFitModel, and LauRooFitSlave.

const LauFitNtuple* LauSimFitSlave::fitNtuple ( ) const
inlineprotected

Const access to the fit ntuple.

Definition at line 84 of file LauSimFitSlave.hh.

LauFitNtuple* LauSimFitSlave::fitNtuple ( )
inlineprotected

Access to the fit ntuple.

Definition at line 87 of file LauSimFitSlave.hh.

virtual Double_t LauSimFitSlave::getTotNegLogLikelihood ( )
pure virtual

Calculates the total negative log-likelihood.

Implements LauFitObject.

Implemented in LauAbsFitModel, and LauRooFitSlave.

virtual void LauSimFitSlave::initialise ( )
pure virtual

Initialise the fit model.

Each class that inherits from this one must implement this to do what is appropriate

Implemented in LauAbsFitModel, LauCPFitModel, LauSimpleFitModel, and LauRooFitSlave.

UInt_t LauSimFitSlave::nSlaves ( ) const
inline

Obtain the number of slaves.

Definition at line 47 of file LauSimFitSlave.hh.

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

Copy assignment operator (not implemented)

virtual void LauSimFitSlave::prepareInitialParArray ( TObjArray &  array)
protectedpure virtual

Package the initial fit parameters for transmission to the master.

Parameters
[out]arraythe array to be filled with the LauParameter objects

Implemented in LauAbsFitModel, and LauRooFitSlave.

void LauSimFitSlave::processMasterRequests ( )
protected

Listen for requests from the master and act accordingly.

Definition at line 122 of file LauSimFitSlave.cc.

virtual UInt_t LauSimFitSlave::readExperimentData ( )
protectedpure virtual

Read in the data for the current experiment.

Returns
the number of events read in

Implemented in LauAbsFitModel, and LauRooFitSlave.

void LauSimFitSlave::runSlave ( const TString &  dataFileName,
const TString &  dataTreeName,
const TString &  histFileName,
const TString &  tableFileName = "",
const TString &  addressMaster = "localhost",
const UInt_t  portMaster = 9090 
)
virtual

Start the slave process for simultaneous fitting.

Parameters
[in]dataFileNamethe name of the input data file
[in]dataTreeNamethe name of the tree containing the data
[in]histFileNamethe file name for the output histograms
[in]tableFileNamethe file name for the latex output file
[in]addressMasterthe hostname of the machine running the master process
[in]portMasterthe port number on which the master process is listening

Definition at line 50 of file LauSimFitSlave.cc.

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

This function sets the parameter values from Minuit.

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

Implements LauFitObject.

Implemented in LauAbsFitModel, and LauRooFitSlave.

void LauSimFitSlave::setupResultsOutputs ( const TString &  histFileName,
const TString &  tableFileName 
)
protectedvirtual

Setup saving of fit results to ntuple/LaTeX table etc.

Provide here a default implementation that produces an ntuple only. Derived classes can override as they wish.

Parameters
[in]histFileNamethe file name for the output histograms
[in]tableFileNamethe file name for the latex output file

Reimplemented in LauAbsFitModel.

Definition at line 86 of file LauSimFitSlave.cc.

UInt_t LauSimFitSlave::slaveId ( ) const
inline

Obtain the ID number of this slave.

Definition at line 50 of file LauSimFitSlave.hh.

virtual Bool_t LauSimFitSlave::verifyFitData ( const TString &  dataFileName,
const TString &  dataTreeName 
)
protectedpure virtual

Open the input file and verify that all required variables are present.

Parameters
[in]dataFileNamethe name of the input file
[in]dataTreeNamethe name of the input tree

Implemented in LauAbsFitModel, and LauRooFitSlave.

void LauSimFitSlave::writeOutAllFitResults ( )
protectedvirtual

Write out any fit results.

Definition at line 289 of file LauSimFitSlave.cc.

Member Data Documentation

LauFitNtuple* LauSimFitSlave::fitNtuple_
private

The fit ntuple.

Definition at line 170 of file LauSimFitSlave.hh.

TMessage* LauSimFitSlave::messageFromMaster_
private

Message from master to the slaves.

Definition at line 158 of file LauSimFitSlave.hh.

UInt_t LauSimFitSlave::nSlaves_
private

The total number of slaves.

Definition at line 164 of file LauSimFitSlave.hh.

Double_t* LauSimFitSlave::parValues_
private

Parameter values array (for reading from the master)

Definition at line 167 of file LauSimFitSlave.hh.

UInt_t LauSimFitSlave::slaveId_
private

Slave id number.

Definition at line 161 of file LauSimFitSlave.hh.

TSocket* LauSimFitSlave::sMaster_
private

A socket to enable parallel setup.

Definition at line 155 of file LauSimFitSlave.hh.


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