Belle II Software  release-06-02-00
DAFRecoFitterModule.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * *
5  * See git log for contributors and copyright holders. *
6  * This file is licensed under LGPL-3.0, see LICENSE.md. *
7  **************************************************************************/
8 
9 #include <tracking/modules/fitter/DAFRecoFitterModule.h>
10 #include <tracking/trackFitting/fitter/base/TrackFitter.h>
11 
12 using namespace Belle2;
13 
14 REG_MODULE(DAFRecoFitter)
15 
17 {
18  setDescription("DAF Fitter using Genfit. If you have TrackCands, you have to convert them to RecoTracks"
19  "using the RecoTrackCreatorModule first. After that, you probably want to add the measurements from the"
20  "hits using the MeasurementCreatorModule.");
21 
22  addParam("probCut", m_param_probabilityCut,
23  "Probability cut for the DAF. Any value between 0 and 1 is possible. Common values are between 0.01 and 0.001",
25 
26  addParam("numberOfFailedHits", m_param_maxNumberOfFailedHits,
27  "Maximum number of failed hits before aborting the fit.", static_cast<int>(TrackFitter::s_defaultMaxFailedHits));
28 
29  addParam("deltaPvalue", m_param_deltaPValue,
30  "If the difference in p-value between two DAF iterations is smaller than this value, the iterative procedure will be terminated early.",
35 }
36 
38 std::shared_ptr<genfit::AbsFitter> DAFRecoFitterModule::createFitter() const
39 {
43  std::shared_ptr<genfit::DAF> fitter = std::make_shared<genfit::DAF>(true, m_param_deltaPValue);
44  fitter->setMaxFailedHits(m_param_maxNumberOfFailedHits);
45 
46  fitter->setProbCut(m_param_probabilityCut);
47 
48  return fitter;
49  } else {
50  // The user has not changed any parameters, so this is basically the default fitter. We return nullptr,
51  // to not reset the fitter and make refitting unnecessary.
52  return std::shared_ptr<genfit::DAF>(nullptr);
53  }
54 }
A base class for all modules that implement a fitter for reco tracks.
int m_param_maxNumberOfFailedHits
Maximum number of failed hits before aborting the fit.
double m_param_deltaPValue
If the delta PValue between two DAF iterations is small than this value, the iterative procedure will...
double m_param_probabilityCut
Probability cut for the DAF.
std::shared_ptr< genfit::AbsFitter > createFitter() const override
Create a DAF fitter.
static constexpr double s_defaultProbCut
Default probCut for the default DAF fitter.
Definition: TrackFitter.h:119
static constexpr double s_defaultDeltaPValue
Default deltaPValue for the default DAF fitter.
Definition: TrackFitter.h:117
static constexpr unsigned int s_defaultMaxFailedHits
Default maxFailedHits for the default DAF fitter.
Definition: TrackFitter.h:121
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.