Belle II Software development
V0VertexFitterFactory Class Reference

Factory creating the V0VertexFitter selected at run time. More...

#include <V0VertexFitterFactory.h>

Static Public Member Functions

static std::unique_ptr< V0VertexFittercreate (const std::string &name)
 Create the fitter registered under the given name.
 
static std::vector< std::string > getNames ()
 Get the names of all the registered fitters.
 
static std::string getNamesAsString ()
 Get the names of all the registered fitters as a single string, for messages and parameter descriptions.
 

Detailed Description

Factory creating the V0VertexFitter selected at run time.

To make a new fitter selectable: implement the V0VertexFitter interface and add one line to the registry in V0VertexFitterFactory.cc, nothing else has to be touched.

Definition at line 27 of file V0VertexFitterFactory.h.

Member Function Documentation

◆ create()

std::unique_ptr< V0VertexFitter > create ( const std::string & name)
static

Create the fitter registered under the given name.

Aborts with a fatal message if the name is not registered.

Parameters
namename of the fitter, as returned by getNames()
Returns
the newly created fitter

Definition at line 37 of file V0VertexFitterFactory.cc.

38{
39 const auto& registry = getRegistry();
40 const auto iterator = registry.find(name);
41 if (iterator == registry.end()) {
42 B2FATAL("Unknown V0 vertex fitter requested."
43 << LogVar("requested fitter", name)
44 << LogVar("available fitters", getNamesAsString()));
45 }
46 return iterator->second();
47}
static std::string getNamesAsString()
Get the names of all the registered fitters as a single string, for messages and parameter descriptio...

◆ getNames()

std::vector< std::string > getNames ( )
static

Get the names of all the registered fitters.

Definition at line 49 of file V0VertexFitterFactory.cc.

50{
51 std::vector<std::string> names;
52 for (const auto& entry : getRegistry()) names.push_back(entry.first);
53 return names;
54}

◆ getNamesAsString()

std::string getNamesAsString ( )
static

Get the names of all the registered fitters as a single string, for messages and parameter descriptions.

Definition at line 56 of file V0VertexFitterFactory.cc.

57{
58 std::string names;
59 for (const auto& name : getNames()) {
60 if (not names.empty()) names += ", ";
61 names += name;
62 }
63 return names;
64}
static std::vector< std::string > getNames()
Get the names of all the registered fitters.

The documentation for this class was generated from the following files: