laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauSimFitSlave.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2015 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
38 #ifndef LAU_SIM_FIT_SLAVE
39 #define LAU_SIM_FIT_SLAVE
40 
41 #include "TMatrixDfwd.h"
42 
43 #include "LauFitObject.hh"
44 
45 class TMessage;
46 class TSocket;
47 class TString;
48 class LauFitNtuple;
49 
50 
51 class LauSimFitSlave : public LauFitObject {
52 
53  public:
56 
58  virtual ~LauSimFitSlave();
59 
61  UInt_t nSlaves() const {return nSlaves_;}
62 
64  UInt_t slaveId() const {return slaveId_;}
65 
67 
75  virtual void runSlave(const TString& dataFileName, const TString& dataTreeName,
76  const TString& histFileName, const TString& tableFileName = "",
77  const TString& addressMaster = "localhost", const UInt_t portMaster = 9090);
78 
80 
84  virtual void initialise() = 0;
85 
87 
91  virtual void setParsFromMinuit(Double_t* par, Int_t npar) = 0;
92 
94  virtual Double_t getTotNegLogLikelihood() = 0;
95 
96  protected:
98  const LauFitNtuple* fitNtuple() const {return fitNtuple_;}
99 
102 
104 
108  void connectToMaster( const TString& addressMaster, const UInt_t portMaster );
109 
111  void processMasterRequests();
112 
114 
121  virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
122 
124 
127  virtual void prepareInitialParArray( TObjArray& array ) = 0;
128 
130 
140  virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat, const TObjArray* parsFromMaster, const TMatrixD* covMat, TObjArray& parsToMaster ) = 0;
141 
143 
147  virtual Bool_t verifyFitData(const TString& dataFileName, const TString& dataTreeName) = 0;
148 
150 
153  virtual UInt_t readExperimentData() = 0;
154 
156  virtual void cacheInputFitVars() = 0;
157 
159  virtual void writeOutAllFitResults();
160 
161  private:
163  LauSimFitSlave(const LauSimFitSlave& rhs);
164 
167 
169  TSocket* sMaster_;
170 
173 
175  UInt_t slaveId_;
176 
178  UInt_t nSlaves_;
179 
181  Double_t* parValues_;
182 
185 
187 };
188 
189 #endif
190 
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:55
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:58
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:44
virtual Bool_t verifyFitData(const TString &dataFileName, const TString &dataTreeName)=0
Open the input file and verify that all required variables are present.