Belle II Software development
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
12using namespace Belle2;
13
14REG_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. Default parameters are read from the database.");
21
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
28std::shared_ptr<genfit::AbsFitter> DAFRecoFitterModule::createFitter() const
29{
30 if (!m_DAFparameters.isValid())
31 B2FATAL("DAF parameters are not available.");
32
33 if (static_cast<float>(m_param_probabilityCut) != m_DAFparameters->getProbabilityCut()) {
35 // Only show this warning the first time a DAF instance is created to avoid spamming logs. Otherwise this warning is shown each event at least once in case of non-default DAF settings / DAF setting not from DB
36 B2WARNING("DAF was called with a different probability cut than the database one (new: " << m_param_probabilityCut << " ; DB: " <<
37 m_DAFparameters->getProbabilityCut() << " ). This new value will be used, the other parameters are read from the database");
39 }
40 std::shared_ptr<genfit::DAF> fitter = std::make_shared<genfit::DAF>(m_DAFparameters->getAnnealingScheme(),
41 m_DAFparameters->getMinimumIterations(),
42 m_DAFparameters->getMaximumIterations(),
43 m_DAFparameters->getMinimumIterationsForPVal(),
44 true,
45 m_DAFparameters->getDeltaPValue(),
46 m_DAFparameters->getDeltaWeight(),
48 fitter->setMaxFailedHits(m_DAFparameters->getMaximumFailedHits());
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}
A base class for all modules that implement a fitter for reco tracks.
DBObjPtr< DAFparameters > m_DAFparameters
DAF parameters Database OjbPtr.
DAFRecoFitterModule()
Module for the DAF fitter.
bool m_changedParametersMessageWasShown
Boolean to only show the warning about changed DAF parameters on first occurrence but not each time a...
double m_param_probabilityCut
Probability cut for the DAF.
std::shared_ptr< genfit::AbsFitter > createFitter() const override
Create a DAF fitter.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
static constexpr double s_defaultProbCut
Default probCut for the default DAF fitter.
Definition: TrackFitter.h:126
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560
#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.