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