laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauSimFitTask.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_TASK
39 #define LAU_SIM_FIT_TASK
40 
41 #include "LauFitObject.hh"
42 
43 #include "TMatrixDfwd.h"
44 
45 class TMessage;
46 class TSocket;
47 class TString;
48 class LauFitNtuple;
49 
50 class LauSimFitTask : public LauFitObject {
51 
52  public:
54  LauSimFitTask();
55 
57  virtual ~LauSimFitTask();
58 
60  UInt_t nTasks() const { return nTasks_; }
61 
63  UInt_t taskId() const { return taskId_; }
64 
66 
74  virtual void runTask( const TString& dataFileName,
75  const TString& dataTreeName,
76  const TString& histFileName,
77  const TString& tableFileName = "",
78  const TString& addressCoordinator = "localhost",
79  const UInt_t portCoordinator = 9090 );
80 
82 
86  virtual void initialise() = 0;
87 
89 
93  virtual void setParsFromMinuit( Double_t* par, Int_t npar ) = 0;
94 
96  virtual Double_t getTotNegLogLikelihood() = 0;
97 
98  protected:
100  const LauFitNtuple* fitNtuple() const { return fitNtuple_; }
101 
104 
106 
110  void connectToCoordinator( const TString& addressCoordinator, const UInt_t portCoordinator );
111 
114 
116 
123  virtual void setupResultsOutputs( const TString& histFileName, const TString& tableFileName );
124 
126 
129  virtual void prepareInitialParArray( TObjArray& array ) = 0;
130 
132 
142  virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
143  const TObjArray* parsFromCoordinator,
144  const TMatrixD* covMat,
145  TObjArray& parsToCoordinator ) = 0;
146 
148 
152  virtual Bool_t verifyFitData( const TString& dataFileName, const TString& dataTreeName ) = 0;
153 
155 
158  virtual UInt_t readExperimentData() = 0;
159 
161  virtual void cacheInputFitVars() = 0;
162 
164  virtual void writeOutAllFitResults();
165 
166  private:
169 
172 
175 
178 
180  UInt_t taskId_;
181 
183  UInt_t nTasks_;
184 
186  Double_t* parValues_;
187 
190 
191  ClassDef( LauSimFitTask, 0 );
192 };
193 
194 #endif
LauSimFitTask()
Constructor.
LauFitNtuple * fitNtuple_
The fit ntuple.
UInt_t nTasks() const
Obtain the number of tasks.
Struct to store fit status information.
Definition: LauAbsFitter.hh:54
virtual void setParsFromMinuit(Double_t *par, Int_t npar)=0
This function sets the parameter values from Minuit.
virtual void runTask(const TString &dataFileName, const TString &dataTreeName, const TString &histFileName, const TString &tableFileName="", const TString &addressCoordinator="localhost", const UInt_t portCoordinator=9090)
Start the task process for simultaneous fitting.
virtual ~LauSimFitTask()
Destructor.
TSocket * socketCoordinator_
A socket to enable parallel setup.
virtual Bool_t verifyFitData(const TString &dataFileName, const TString &dataTreeName)=0
Open the input file and verify that all required variables are present.
UInt_t taskId_
Task id number.
LauFitNtuple * fitNtuple()
Access to the fit ntuple.
UInt_t nTasks_
The total number of tasks.
The base class for any task process for simultaneous/combined fits.
virtual void initialise()=0
Initialise the fit model.
virtual UInt_t readExperimentData()=0
Read in the data for the current experiment.
virtual void prepareInitialParArray(TObjArray &array)=0
Package the initial fit parameters for transmission to the coordinator.
virtual Double_t getTotNegLogLikelihood()=0
Calculates the total negative log-likelihood.
UInt_t taskId() const
Obtain the ID number of this task.
Class to store the results from the fit into an ntuple.
Definition: LauFitNtuple.hh:58
void processCoordinatorRequests()
Listen for requests from the coordinator and act accordingly.
LauSimFitTask(const LauSimFitTask &rhs)
Copy constructor (not implemented)
const LauFitNtuple * fitNtuple() const
Const access to the fit ntuple.
virtual void cacheInputFitVars()=0
Cache the input data values to calculate the likelihood during the fit.
virtual void finaliseExperiment(const LauAbsFitter::FitStatus &fitStat, const TObjArray *parsFromCoordinator, const TMatrixD *covMat, TObjArray &parsToCoordinator)=0
Perform all finalisation actions.
Double_t * parValues_
Parameter values array (for reading from the coordinator)
virtual void writeOutAllFitResults()
Write out any fit results.
The abstract interface for the objects that control the calculation of the likelihood.
Definition: LauFitObject.hh:47
virtual void setupResultsOutputs(const TString &histFileName, const TString &tableFileName)
Setup saving of fit results to ntuple/LaTeX table etc.
void connectToCoordinator(const TString &addressCoordinator, const UInt_t portCoordinator)
Establish the connection to the coordinator process.
LauSimFitTask & operator=(const LauSimFitTask &rhs)
Copy assignment operator (not implemented)
File containing declaration of LauFitObject class.
TMessage * messageFromCoordinator_
Message from coordinator to the tasks.