Belle II Software development
PXDMeasurementCreatorFactory Class Reference

Add all measurement creators related to PXD hits. More...

#include <PXDMeasurementCreatorFactory.h>

Inheritance diagram for PXDMeasurementCreatorFactory:
MeasurementCreatorFactory< PXDBaseMeasurementCreator >

Public Types

typedef PXDBaseMeasurementCreator CreatorType
 Typedef for convenience.
 

Public Member Functions

 PXDMeasurementCreatorFactory (const genfit::MeasurementFactory< genfit::AbsMeasurement > &measurementFactory)
 Initialize with a measurement factory.
 
PXDBaseMeasurementCreatorcreateMeasurementCreatorFromName (const std::string &creatorName) const override
 Only a simple reco hit creator and the momentum estimation is implemented in the moment.
 
void initialize ()
 Use the parameters given to the module and create the measurement creators from them.
 
const std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > & getCreators () const
 Return the creators to the module.
 
std::map< std::string, std::map< std::string, std::string > > & getParameters ()
 Return a reference to the parameters you can use in the module.
 
void setParameters (const std::map< std::string, std::map< std::string, std::string > > &creatorsWithParametersDictionary)
 Set the parameters.
 

Private Attributes

const genfit::MeasurementFactory< genfit::AbsMeasurement > & m_measurementFactory
 A reference to the prefilled measurement factory.
 
std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > m_measurementCreators
 A vector with the measurement creators.
 
std::map< std::string, std::map< std::string, std::string > > m_creatorsWithParametersDictionary
 The map of dictionaries of the parameters.
 

Detailed Description

Add all measurement creators related to PXD hits.

Definition at line 20 of file PXDMeasurementCreatorFactory.h.

Member Typedef Documentation

◆ CreatorType

Typedef for convenience.

Definition at line 35 of file MeasurementCreatorFactory.h.

Constructor & Destructor Documentation

◆ PXDMeasurementCreatorFactory()

PXDMeasurementCreatorFactory ( const genfit::MeasurementFactory< genfit::AbsMeasurement > &  measurementFactory)
inlineexplicit

Initialize with a measurement factory.

Definition at line 25 of file PXDMeasurementCreatorFactory.h.

25 :
26 MeasurementCreatorFactory<PXDBaseMeasurementCreator>(),
27 m_measurementFactory(measurementFactory) {}
const genfit::MeasurementFactory< genfit::AbsMeasurement > & m_measurementFactory
A reference to the prefilled measurement factory.

Member Function Documentation

◆ createMeasurementCreatorFromName()

PXDBaseMeasurementCreator * createMeasurementCreatorFromName ( const std::string &  creatorName) const
inlineoverridevirtual

Only a simple reco hit creator and the momentum estimation is implemented in the moment.

Reimplemented from MeasurementCreatorFactory< PXDBaseMeasurementCreator >.

Definition at line 30 of file PXDMeasurementCreatorFactory.h.

32 {
33 if (creatorName == "RecoHitCreator") {
35 } else if (creatorName == "MomentumEstimationCreator") {
37 }
38
39 return nullptr;
40 }
VXDMomentumEstimationMeasurementCreator< RecoHitInformation::UsedPXDHit, Const::PXD > PXDMomentumMeasurementCreator
Momentum measurement creator for the PXD.
CoordinateMeasurementCreator< RecoHitInformation::UsedPXDHit, Const::PXD > PXDCoordinateMeasurementCreator
Hit to reco hit measurement creator for the PXD.

◆ getCreators()

const std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > & getCreators ( ) const
inlineinherited

Return the creators to the module.

Definition at line 67 of file MeasurementCreatorFactory.h.

68 {
70 }
std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > m_measurementCreators
A vector with the measurement creators.

◆ getParameters()

std::map< std::string, std::map< std::string, std::string > > & getParameters ( )
inlineinherited

Return a reference to the parameters you can use in the module.

Definition at line 73 of file MeasurementCreatorFactory.h.

74 {
76 }
std::map< std::string, std::map< std::string, std::string > > m_creatorsWithParametersDictionary
The map of dictionaries of the parameters.

◆ initialize()

void initialize ( )
inlineinherited

Use the parameters given to the module and create the measurement creators from them.

Definition at line 38 of file MeasurementCreatorFactory.h.

39 {
40 for (const auto& creatorWithParameterDictionary : m_creatorsWithParametersDictionary) {
41 const std::string& creatorName = creatorWithParameterDictionary.first;
42 const std::map<std::string, std::string>& parameterDictionary = creatorWithParameterDictionary.second;
43
44 B2DEBUG(100, "Creating measurement creator with name " << creatorName);
45
46 BaseMeasurementCreatorType* creatorPointer = createMeasurementCreatorFromName(creatorName);
47 if (creatorPointer == nullptr) {
48 B2FATAL("Can not create a measurement creator with the name " << creatorName << ". Creator not known to the factory.");
49 }
50 m_measurementCreators.push_back(std::move(std::shared_ptr<BaseMeasurementCreatorType>(creatorPointer)));
51
52 for (const auto& parameterWithValue : parameterDictionary) {
53 const std::string& parameterName = parameterWithValue.first;
54 const std::string& parameterValue = parameterWithValue.second;
55 creatorPointer->setParameter(parameterName, parameterValue);
56 }
57 }
58 }
virtual PXDBaseMeasurementCreator * createMeasurementCreatorFromName(const std::string &) const
Overload this method to create the measurement creators by their name.

◆ setParameters()

void setParameters ( const std::map< std::string, std::map< std::string, std::string > > &  creatorsWithParametersDictionary)
inlineinherited

Set the parameters.

Definition at line 79 of file MeasurementCreatorFactory.h.

80 {
81 m_creatorsWithParametersDictionary = std::move(creatorsWithParametersDictionary);
82 }

Member Data Documentation

◆ m_creatorsWithParametersDictionary

std::map<std::string, std::map<std::string, std::string> > m_creatorsWithParametersDictionary
privateinherited

The map of dictionaries of the parameters.

Fill it with the module parameters.

Definition at line 89 of file MeasurementCreatorFactory.h.

◆ m_measurementCreators

std::vector<std::shared_ptr<PXDBaseMeasurementCreator > > m_measurementCreators
privateinherited

A vector with the measurement creators.

Is filled in initialize.

Definition at line 86 of file MeasurementCreatorFactory.h.

◆ m_measurementFactory

const genfit::MeasurementFactory<genfit::AbsMeasurement>& m_measurementFactory
private

A reference to the prefilled measurement factory.

Definition at line 43 of file PXDMeasurementCreatorFactory.h.


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