laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauSimFitSlave.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2013 - 2015.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
24 #ifndef LAU_SIM_FIT_SLAVE
25 #define LAU_SIM_FIT_SLAVE
26 
27 #include "TMatrixDfwd.h"
28 
29 #include "LauFitObject.hh"
30 
31 class TMessage;
32 class TSocket;
33 class TString;
34 class LauFitNtuple;
35 
36 
37 class LauSimFitSlave : public LauFitObject {
38 
39  public:
42 
44  virtual ~LauSimFitSlave();
45 
47  UInt_t nSlaves() const {return nSlaves_;}
48 
50  UInt_t slaveId() const {return slaveId_;}
51 
53 
61  virtual void runSlave(const TString& dataFileName, const TString& dataTreeName,
62  const TString& histFileName, const TString& tableFileName = "",
63  const TString& addressMaster = "localhost", const UInt_t portMaster = 9090);
64 
66 
70  virtual void initialise() = 0;
71 
73 
77  virtual void setParsFromMinuit(Double_t* par, Int_t npar) = 0;
78 
80  virtual Double_t getTotNegLogLikelihood() = 0;
81 
82  protected:
84  const LauFitNtuple* fitNtuple() const {return fitNtuple_;}
85 
88 
90 
94  void connectToMaster( const TString& addressMaster, const UInt_t portMaster );
95 
97  void processMasterRequests();
98 
100 
107  virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
108 
110 
113  virtual void prepareInitialParArray( TObjArray& array ) = 0;
114 
116 
126  virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromMaster, const TMatrixD* covMat, TObjArray& parsToMaster ) = 0;
127 
129 
133  virtual Bool_t verifyFitData(const TString& dataFileName, const TString& dataTreeName) = 0;
134 
136 
139  virtual UInt_t readExperimentData() = 0;
140 
142  virtual void cacheInputFitVars() = 0;
143 
145  virtual void writeOutAllFitResults();
146 
147  private:
149  LauSimFitSlave(const LauSimFitSlave& rhs);
150 
153 
155  TSocket* sMaster_;
156 
159 
161  UInt_t slaveId_;
162 
164  UInt_t nSlaves_;
165 
167  Double_t* parValues_;
168 
171 
173 };
174 
175 #endif
176 
LauSimFitSlave()
Constructor.
LauSimFitSlave & operator=(const LauSimFitSlave &rhs)
Copy assignment operator (not implemented)
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.
virtual void setupResultsOutputs(const TString &histFileName, const TString &tableFileName)
Setup saving of fit results to ntuple/LaTeX table etc.
UInt_t slaveId_
Slave id number.
void processMasterRequests()
Listen for requests from the master and act accordingly.
virtual void writeOutAllFitResults()
Write out any fit results.
virtual ~LauSimFitSlave()
Destructor.
virtual UInt_t readExperimentData()=0
Read in the data for the current experiment.
const LauFitNtuple * fitNtuple() const
Const access to the fit ntuple.
LauFitNtuple * fitNtuple_
The fit ntuple.
ClassDef(LauSimFitSlave, 0)
LauFitNtuple * fitNtuple()
Access to the fit ntuple.
virtual void finaliseExperiment(const LauAbsFitter::FitStatus &fitStat, const TObjArray *parsFromMaster, const TMatrixD *covMat, TObjArray &parsToMaster)=0
Perform all finalisation actions.
void connectToMaster(const TString &addressMaster, const UInt_t portMaster)
Establish the connection to the master process.
TSocket * sMaster_
A socket to enable parallel setup.
Struct to store fit status information.
Definition: LauAbsFitter.hh:41
virtual void prepareInitialParArray(TObjArray &array)=0
Package the initial fit parameters for transmission to the master.
TMessage * messageFromMaster_
Message from master to the slaves.
virtual void setParsFromMinuit(Double_t *par, Int_t npar)=0
This function sets the parameter values from Minuit.
UInt_t slaveId() const
Obtain the ID number of this slave.
virtual void initialise()=0
Initialise the fit model.
File containing declaration of LauFitObject class.
virtual Double_t getTotNegLogLikelihood()=0
Calculates the total negative log-likelihood.
Class to store the results from the fit into an ntuple.
Definition: LauFitNtuple.hh:44
UInt_t nSlaves() const
Obtain the number of slaves.
The base class for any slave process for simultaneous/combined fits.
virtual void cacheInputFitVars()=0
Cache the input data values to calculate the likelihood during the fit.
UInt_t nSlaves_
The total number of slaves.
Double_t * parValues_
Parameter values array (for reading from the master)
The abstract interface for the objects that control the calculation of the likelihood.
Definition: LauFitObject.hh:30
virtual Bool_t verifyFitData(const TString &dataFileName, const TString &dataTreeName)=0
Open the input file and verify that all required variables are present.