Belle II Software  release-08-01-10
MeasurementAdder Class Reference

Algorithm class to translate the added detector hits (e.g. More...

#include <MeasurementAdder.h>

Collaboration diagram for MeasurementAdder:

Public Member Functions

 MeasurementAdder (const std::string &storeArrayNameOfPXDHits, const std::string &storeArrayNameOfSVDHits, const std::string &storeArrayNameOfCDCHits, const std::string &storeArrayNameOfBKLMHits, const std::string &storeArrayNameOfEKLMHits, const bool initializeCDCTranslators=true)
 Create a new instance of the measurement adder. More...
 
void resetMeasurementCreatorsToDefaultSettings ()
 Reset the internal measurement creator storage to the default settings. More...
 
void resetMeasurementCreators (const std::vector< std::shared_ptr< PXDBaseMeasurementCreator >> &pxdMeasurementCreators, const std::vector< std::shared_ptr< SVDBaseMeasurementCreator >> &svdMeasurementCreators, const std::vector< std::shared_ptr< CDCBaseMeasurementCreator >> &cdcMeasurementCreators, const std::vector< std::shared_ptr< BKLMBaseMeasurementCreator >> &bklmMeasurementCreators, const std::vector< std::shared_ptr< EKLMBaseMeasurementCreator >> &eklmMeasurementCreators, const std::vector< std::shared_ptr< BaseMeasurementCreator >> &additionalMeasurementCreators)
 If you want to use non-default settings for the store arrays, you can create your own instances of the measurement creators for the different detectors and use them here. More...
 
void resetMeasurementCreatorsUsingFactories (const std::map< std::string, std::map< std::string, std::string >> &pxdMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &svdMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &cdcMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &bklmMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &eklmMeasurementCreators, const std::map< std::string, std::map< std::string, std::string >> &additionalMeasurementCreators)
 If you want to use non-default settings for the store arrays, you can create your own instances of the measurement creators for the different detectors and use them here. More...
 
bool addMeasurements (RecoTrack &recoTrack) const
 After you have filled the internal storage with measurement creators (either by providing your own or by using the default settings), you can use then to add measurements to the reco tracks with this function. More...
 

Private Member Functions

void createGenfitMeasurementFactory ()
 Helper function to create a genfit::MeasurementFactory, needed in the MeasurementCreators.
 
template<class HitType , Const::EDetector detector>
void addMeasurementsFromHitToRecoTrack (RecoTrack &recoTrack, RecoHitInformation &recoHitInformation, HitType *hit, const std::vector< std::shared_ptr< BaseMeasurementCreatorFromHit< HitType, detector >>> &measurementCreators, std::map< genfit::TrackPoint *, RecoHitInformation * > &trackPointHitMapping) const
 Helper: Go through all measurement creators in the given list and create the measurement with a given hit.
 
void addMeasurementsToRecoTrack (RecoTrack &recoTrack, const std::vector< std::shared_ptr< BaseMeasurementCreator >> &measurementCreators) const
 Helper: Go through all measurement creators in the given list and create the measurement without a given hit.
 

Private Attributes

std::string m_param_storeArrayNameOfPXDHits = ""
 The name of the store array for the PXD hits.
 
std::string m_param_storeArrayNameOfSVDHits = ""
 The name of the store array for the SVD hits.
 
std::string m_param_storeArrayNameOfCDCHits = ""
 The name of the store array for the CDC hits.
 
std::string m_param_storeArrayNameOfBKLMHits = ""
 The name of the store array for the BKLM hits.
 
std::string m_param_storeArrayNameOfEKLMHits = ""
 The name of the store array for the EKLM hits.
 
bool m_skipDirtyCheck = false
 Flag to skip the dirty check. Useful when using non default measurement creators.
 
std::vector< std::shared_ptr< PXDBaseMeasurementCreator > > m_pxdMeasurementCreators
 Internal storage of the PXD measurement creators.
 
std::vector< std::shared_ptr< SVDBaseMeasurementCreator > > m_svdMeasurementCreators
 Internal storage of the SVD measurement creators.
 
std::vector< std::shared_ptr< CDCBaseMeasurementCreator > > m_cdcMeasurementCreators
 Internal storage of the CDC measurement creators.
 
std::vector< std::shared_ptr< BKLMBaseMeasurementCreator > > m_bklmMeasurementCreators
 Internal storage of the BKLM measurement creators.
 
std::vector< std::shared_ptr< EKLMBaseMeasurementCreator > > m_eklmMeasurementCreators
 Internal storage of the EKLM measurement creators.
 
std::vector< std::shared_ptr< BaseMeasurementCreator > > m_additionalMeasurementCreators
 Internal storage of the additional measurement creators.
 
genfit::MeasurementFactory< genfit::AbsMeasurementm_genfitMeasurementFactory
 Internal storage of the genfit measurement factory;.
 

Detailed Description

Algorithm class to translate the added detector hits (e.g.

CDCHits) to internal TrackPoints before fitting. This can be - depending on your setting - a non trivial process and should be taken care only by this class.

You probably do not have to use this class on your own but use the TrackFitter for that.

Before fitting a reco track with the track fitter class, you have to translate all detector signals into measurements (contained in TrackPoints) for genfit. This is done using predefined measurement creator classes.

If you do not want non-default settings, you can call the measurement adder class with the following lines of code:

MeasurementAdder measurementAdder; measurementAdder.setMeasurementCreatorsToDefaultSettings()

measurementAdder.addMeasurements(recoTrack);

After that, you can fit the track (see the TrackFitter class).

If you want to provide special settings, you can either create a list of MeasurementCreators for the three detectors and for the case without detector by yourself or you use the MeasurementCreatorFactories. Both cases are shown below:

MeasurementAdder measurementAdder; // Possibility 1 measurementAdder.setMeasurementCreators({ cdcMeasurementCreatorSharedPointer1, cdcMeasurementCreatorSharedPointer2, ...}, { svdMeasurementCreatorSharedPointer1, ...}, { pxdMeasurementCreatorSharedPointer1, ...}, { additionalMeasurementCreatorSharedPointer1, ...})

// Possibility 2 measurementAdder.setMeasurementCreatorsUsingFactories( mapOfCreatorNamesAndSettingsForCDC, mapOfCreatorNamesAndSettingsForSVD, mapOfCreatorNamesAndSettingsForPXD, mapOfCreatorNamesAndSettingsForAdditionalMeasurements )

measurementAdder.addMeasurements(recoTrack);

Definition at line 76 of file MeasurementAdder.h.

Constructor & Destructor Documentation

◆ MeasurementAdder()

MeasurementAdder ( const std::string &  storeArrayNameOfPXDHits,
const std::string &  storeArrayNameOfSVDHits,
const std::string &  storeArrayNameOfCDCHits,
const std::string &  storeArrayNameOfBKLMHits,
const std::string &  storeArrayNameOfEKLMHits,
const bool  initializeCDCTranslators = true 
)

Create a new instance of the measurement adder.

You probably only have to do this once in your module, except the case you want to test out different settings.

Configures whether the CDC Translators should be initialized by the FitterModule especially useful for VXD-only beamtest. In the future this could be changed to check implicitly if the cdc is available in the geometry.

Definition at line 38 of file MeasurementAdder.cc.

44  :
45  m_param_storeArrayNameOfPXDHits(storeArrayNameOfPXDHits),
46  m_param_storeArrayNameOfSVDHits(storeArrayNameOfSVDHits),
47  m_param_storeArrayNameOfCDCHits(storeArrayNameOfCDCHits),
48  m_param_storeArrayNameOfBKLMHits(storeArrayNameOfBKLMHits),
49  m_param_storeArrayNameOfEKLMHits(storeArrayNameOfEKLMHits)
50 {
54  if (initializeCDCTranslators) {
55  // Create new Translators and give them to the CDCRecoHits.
59  true);
60  }
63 }
static void setTranslators(CDC::ADCCountTranslatorBase *const adcCountTranslator, CDC::CDCGeometryTranslatorBase *const cdcGeometryTranslator, CDC::TDCCountTranslatorBase *const tdcCountTranslator, bool useTrackTime=false, bool cosmics=false)
Setter for the Translators.
Definition: CDCRecoHit.cc:33
This class simply assumes a linear translation through (0,0)
This class uses the realistic detector geometry (the one after alignment procedure) for the translati...
Translator mirroring the realistic Digitization.
void createGenfitMeasurementFactory()
Helper function to create a genfit::MeasurementFactory, needed in the MeasurementCreators.
std::string m_param_storeArrayNameOfPXDHits
The name of the store array for the PXD hits.
std::string m_param_storeArrayNameOfBKLMHits
The name of the store array for the BKLM hits.
void resetMeasurementCreatorsToDefaultSettings()
Reset the internal measurement creator storage to the default settings.
std::string m_param_storeArrayNameOfSVDHits
The name of the store array for the SVD hits.
std::string m_param_storeArrayNameOfEKLMHits
The name of the store array for the EKLM hits.
std::string m_param_storeArrayNameOfCDCHits
The name of the store array for the CDC hits.

Member Function Documentation

◆ addMeasurements()

bool addMeasurements ( RecoTrack recoTrack) const

After you have filled the internal storage with measurement creators (either by providing your own or by using the default settings), you can use then to add measurements to the reco tracks with this function.

Attention
If you are using default measurement creators and the dirty flag of the reco track is not set, this method will return and not nothing, as we do not want to recreate all measurements twice. If you want to create all measurements again (because you used different settings before), you have to set the dirty flag of the reco track manually.

Returns true, if the track should be refitted afterwards and false else.

Definition at line 160 of file MeasurementAdder.cc.

◆ resetMeasurementCreators()

void resetMeasurementCreators ( const std::vector< std::shared_ptr< PXDBaseMeasurementCreator >> &  pxdMeasurementCreators,
const std::vector< std::shared_ptr< SVDBaseMeasurementCreator >> &  svdMeasurementCreators,
const std::vector< std::shared_ptr< CDCBaseMeasurementCreator >> &  cdcMeasurementCreators,
const std::vector< std::shared_ptr< BKLMBaseMeasurementCreator >> &  bklmMeasurementCreators,
const std::vector< std::shared_ptr< EKLMBaseMeasurementCreator >> &  eklmMeasurementCreators,
const std::vector< std::shared_ptr< BaseMeasurementCreator >> &  additionalMeasurementCreators 
)

If you want to use non-default settings for the store arrays, you can create your own instances of the measurement creators for the different detectors and use them here.

For this method, you have to create the measurement creators by yourself.

It is assumed, that you only do this for non-default settings. This is why all measurement points will be recreated (independent on the dirty flag) and the track must be refitted afterwards.

Definition at line 103 of file MeasurementAdder.cc.

◆ resetMeasurementCreatorsToDefaultSettings()

void resetMeasurementCreatorsToDefaultSettings ( )

Reset the internal measurement creator storage to the default settings.

The measurements will not be recreated if the dirty flag is not set (the hit content did not change).

Definition at line 91 of file MeasurementAdder.cc.

◆ resetMeasurementCreatorsUsingFactories()

void resetMeasurementCreatorsUsingFactories ( const std::map< std::string, std::map< std::string, std::string >> &  pxdMeasurementCreators,
const std::map< std::string, std::map< std::string, std::string >> &  svdMeasurementCreators,
const std::map< std::string, std::map< std::string, std::string >> &  cdcMeasurementCreators,
const std::map< std::string, std::map< std::string, std::string >> &  bklmMeasurementCreators,
const std::map< std::string, std::map< std::string, std::string >> &  eklmMeasurementCreators,
const std::map< std::string, std::map< std::string, std::string >> &  additionalMeasurementCreators 
)

If you want to use non-default settings for the store arrays, you can create your own instances of the measurement creators for the different detectors and use them here.

In this method, the measurement creators are created by MeasurementCreatorFactories. For this, you have to give a map in the form { "creatorName" : { "parameterName1": parameterValue1, "parameterName2": parameterValue2, ... }, "otherCreatorName" : { "otherParameterName1": otherParameterValue1, ... }, ... } for each detector and for additional measurements. See the MeasurementCreatorFactories for more details.

It is assumed, that you only do this for non-default settings. This is why all measurement points will be recreated (independent on the dirty flag) and the track must be refitted afterwards.

Definition at line 121 of file MeasurementAdder.cc.


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