laura is hosted by Hepforge, IPPP Durham
Laura++  3.6.0
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauRooFitTask.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2017 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 
35 #ifndef LAU_ROO_FIT_TASK
36 #define LAU_ROO_FIT_TASK
37 
38 #include "LauSimFitTask.hh"
39 
40 #include "RooArgSet.h"
41 #include "TMatrixDfwd.h"
42 #include "TString.h"
43 
44 #include <set>
45 #include <utility>
46 #include <vector>
47 
48 class LauParameter;
49 class RooAbsData;
50 class RooAbsPdf;
51 class RooFormulaVar;
52 class RooNLLVar;
53 class RooRealVar;
54 class TFile;
55 class TTree;
56 
57 class LauRooFitTask : public LauSimFitTask {
58 
59  public:
61  LauRooFitTask( RooAbsPdf& model,
62  const Bool_t extended,
63  const RooArgSet& vars,
64  const TString& weightVarName = "" );
65 
67  virtual ~LauRooFitTask();
68 
70  virtual void initialise();
71 
73 
77  virtual void setParsFromMinuit( Double_t* par, Int_t npar );
78 
80  virtual Double_t getTotNegLogLikelihood();
81 
82  protected:
84 
87  virtual void prepareInitialParArray( TObjArray& array );
88 
90 
94  LauParameter* convertToLauParameter( const RooRealVar* rooParameter ) const;
95 
97 
101  std::vector<std::pair<RooRealVar*, LauParameter*>> convertToLauParameters(
102  const RooFormulaVar* rooFormula ) const;
103 
105 
115  virtual void finaliseExperiment( const LauAbsFitter::FitStatus& fitStat,
116  const TObjArray* parsFromCoordinator,
117  const TMatrixD* covMat,
118  TObjArray& parsToCoordinator );
119 
121 
125  virtual Bool_t verifyFitData( const TString& dataFileName, const TString& dataTreeName );
126 
128 
131  virtual UInt_t readExperimentData();
132 
134  virtual void cacheInputFitVars();
135 
136  private:
138  void cleanData();
139 
142 
145 
147  RooAbsPdf& model_;
148 
150  RooArgSet dataVars_;
151 
153  TString weightVarName_;
154 
156  TFile* dataFile_;
157 
159  TTree* dataTree_;
160 
162  RooAbsData* exptData_;
163 
165  const Bool_t extended_;
166 
168  std::set<UInt_t> iExptSet_;
169 
171  RooNLLVar* nllVar_;
172 
174  std::vector<RooRealVar*> fitVars_;
175 
177  std::vector<LauParameter*> fitPars_;
178 
179  ClassDef( LauRooFitTask, 0 );
180 };
181 
182 #endif
LauParameter * convertToLauParameter(const RooRealVar *rooParameter) const
Convert a RooRealVar into a LauParameter.
const Bool_t extended_
Is the PDF extended?
virtual Bool_t verifyFitData(const TString &dataFileName, const TString &dataTreeName)
Open the input file and verify that all required variables are present.
RooNLLVar * nllVar_
The NLL variable.
Class for defining the fit parameter objects.
Definition: LauParameter.hh:49
Struct to store fit status information.
Definition: LauAbsFitter.hh:54
LauRooFitTask & operator=(const LauRooFitTask &rhs)
Copy assignment operator (not implemented)
virtual ~LauRooFitTask()
Destructor.
A class for creating a RooFit-based task process for simultaneous/combined fits.
RooAbsPdf & model_
The model.
The base class for any task process for simultaneous/combined fits.
virtual UInt_t readExperimentData()
Read in the data for the current experiment.
virtual void initialise()
Initialise the fit model.
virtual void finaliseExperiment(const LauAbsFitter::FitStatus &fitStat, const TObjArray *parsFromCoordinator, const TMatrixD *covMat, TObjArray &parsToCoordinator)
Perform all finalisation actions.
std::set< UInt_t > iExptSet_
The experiment category variable.
LauRooFitTask(RooAbsPdf &model, const Bool_t extended, const RooArgSet &vars, const TString &weightVarName="")
Constructor.
virtual void setParsFromMinuit(Double_t *par, Int_t npar)
This function sets the parameter values from Minuit.
std::vector< std::pair< RooRealVar *, LauParameter * > > convertToLauParameters(const RooFormulaVar *rooFormula) const
Convert a RooFormulaVar into LauParameters.
std::vector< LauParameter * > fitPars_
The fit parameters (as LauParameter's)
LauRooFitTask(const LauRooFitTask &rhs)
Copy constructor (not implemented)
TString weightVarName_
The name of the (optional) weight variable in the dataset.
virtual void prepareInitialParArray(TObjArray &array)
Package the initial fit parameters for transmission to the coordinator.
std::vector< RooRealVar * > fitVars_
The fit parameters (as RooRealVar's)
TTree * dataTree_
The data tree.
void cleanData()
Cleanup the data.
RooAbsData * exptData_
The data for the current experiment.
File containing declaration of LauSimFitTask class.
TFile * dataFile_
The data file.
RooArgSet dataVars_
The dataset variables.
virtual void cacheInputFitVars()
Cache the input data values to calculate the likelihood during the fit.
virtual Double_t getTotNegLogLikelihood()
Calculates the total negative log-likelihood.