Belle II Software development
TrackFitter Class Reference

Algorithm class to handle the fitting of RecoTrack objects. More...

#include <TrackFitter.h>

Public Member Functions

 TrackFitter (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 fitter instance.
 
void resetFitter (const std::shared_ptr< genfit::AbsFitter > &fitter)
 Set the internal storage of the fitter to a provided one, if you want to use non-default settings.
 
void resetFitterToDBSettings ()
 Use the DB settings of the fitter to fit the reco tracks.
 
void resetFitterToUserSettings (DAFparameters *DAFparams)
 Use the user settings of the fitter to fit the reco tracks.
 
void resetFitterToCosmicsSettings ()
 Use the settings of the fitter to fit the reco tracks for cosmics data.
 
bool fit (RecoTrack &recoTrack, genfit::AbsTrackRep *trackRepresentation, bool resortHits=false) const
 Fit a reco track with a given non-default track representation.
 
bool fit (RecoTrack &recoTrack, const Const::ChargedStable &particleType, bool resortHits=false) const
 Fit a reco track with the given particle hypothesis, or with pion as default.
 
bool fit (RecoTrack &recoTrack, const int pdgCode, bool resortHits=false) const
 Same as above, but hypothesis set by pdg code.
 
bool fit (RecoTrack &recoTrack, bool resortHits=false) const
 Fit a reco track with the already present cardinal representation or with pion as default.
 
void resetMeasurementCreatorsToDefaultSettings ()
 Reset the internal measurement creator storage to the default settings.
 
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.
 
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.
 
void setgErrorIgnoreLevel (Int_t errorIgnoreLevel)
 Set the gErrorIgnoreLevel for the fitter.
 
Int_t getgErrorIgnoreLevel ()
 Return the currently set gErrorIgnoreLevel for the fitter.
 

Static Public Member Functions

static int createCorrectPDGCodeForChargedStable (const Const::ChargedStable &particleType, const RecoTrack &recoTrack)
 Helper function to multiply the PDG code of a charged stable with the charge of the reco track (if needed)
 

Static Public Attributes

static constexpr double s_defaultDeltaPValue = 1.0
 Default deltaPValue for the default DAF fitter.
 
static constexpr double s_defaultProbCut = 0.001
 Default probCut for the default DAF fitter.
 
static constexpr unsigned int s_defaultMaxFailedHits = 5
 Default maxFailedHits for the default DAF fitter.
 

Private Member Functions

bool fitWithoutCheck (RecoTrack &recoTrack, const genfit::AbsTrackRep &trackRepresentation, bool resortHits=false) const
 Helper function to do the fit.
 

Private Attributes

std::shared_ptr< genfit::AbsFitter > m_fitter
 The internal storage of the used fitting algorithms.
 
bool m_skipDirtyCheck = false
 Flag to skip the dirty flag check which is needed when using non-default fitters.
 
MeasurementAdder m_measurementAdder
 The measurement adder algorithm class.
 
Int_t m_gErrorIgnoreLevel = kFatal
 Control the output level of the ROOT functions used by the GenFit fitter. Default is increased from kError to kFatal;.
 
DBObjPtr< DAFparametersm_DAFparameters
 DAF parameters Database OjbPtr.
 

Detailed Description

Algorithm class to handle the fitting of RecoTrack objects.

The fitting of reco tracks implies non-trivial synchronisation, so you should only use this class for fitting RecoTrack instances.

After having created a RecoTrack and added hits to it, you can fit the RecoTrack.

RecoTrack recoTrack; ... add CDC hits etc. ... ... set seeds etc. ...

The standard case

Typical use case if you do not use the fitter modules but want to fit in your own module.

TrackFitter trackFitter; trackFitter.fit(recoTrack);

-> Create measurements if hit content has changed (dirty flag) -> Fit (again) if (a) no fit result present or (b) hit content has changed (dirty flag)

If resortHits is True, the hits are resorted while fitting (e.g. using the track length) if the underlying fitter supports it.

Non-default fitter

May be used if you know that the default fitting algorithm is not suited for your use case. Please be aware, that the following modules may use your fit results, if the hit content is not changed, although they may expect a "default"-fit. Because the currently present fit results were probably created with the default fitter, the fit is executed always (and not only when the hit content has changed).

ATTENTION: If the hit content did not change (the dirty flag is not set), the track will not be refitted later! Future modules may expect a default fit!

TrackFitter trackFitter; trackFitter.resetFitter( ... ); trackFitter.fit(recoTrack);

-> Create measurements if hit content has changed (dirty flag) -> Always fitted

If resortHits is True, the hits are resorted while fitting (e.g. using the track length) if the underlying fitter supports it.

Non-default track representations

Useful if you know you have an electron/etc. instead of a pion. Please make sure that the cardinal representation points to the correct representation - especially when you try out non-RKTrackRep objects. ATTENTION: Once a track representation is added to the track, it will always be also used when fitting! If you do not want this, remove this track representation again.

TrackFitter trackFitter; // Maybe set other fit algorithm. trackFitter.fit(recoTrack, particleType); or trackFitter.fit(recoTrack, trackRep);

-> Create measurements if hit content has changed (dirty flag) -> Fit (again) if (a) added track representation is new or (b) hit content has changed (dirty flag) or (c) you use a non-default fitter.

If resortHits is True, the hits are resorted while fitting (e.g. using the track length) if the underlying fitter supports it.

Non-default measurements

This is only needed in very rare cases, when you want to transform the added hits into measurement points for your special use case e.g. alignment or VXD-dEdX-momentum estimation.

ATTENTION: Again, please be aware that future modules may expect fit results from a default fit!

TrackFitter trackFitter; // Possibility 1 trackFitter.resetMeasurementCreators({ cdcMeasurementCreatorSharedPointer1, cdcMeasurementCreatorSharedPointer2, ...}, { svdMeasurementCreatorSharedPointer1, ...}, { pxdMeasurementCreatorSharedPointer1, ...}, { additionalMeasurementCreatorSharedPointer1, ...}) // Possibility 2 measurementAdder.resetMeasurementCreatorsUsingFactories( mapOfCreatorNamesAndSettingsForCDC, mapOfCreatorNamesAndSettingsForSVD, mapOfCreatorNamesAndSettingsForPXD, mapOfCreatorNamesAndSettingsForAdditionalMeasurements )

// Maybe set other fit algorithm. trackFitter.fit(recoTrack); // or maybe use a different track representation/particle hypothesis.

-> Always recreate all measurements (not only when hit content has changed). -> Always refit (not only when using non default parameters or hit content has changed or track representation is new).

If resortHits is True, the hits are resorted while fitting (e.g. using the track length) if the underlying fitter supports it.

Definition at line 121 of file TrackFitter.h.

Constructor & Destructor Documentation

◆ TrackFitter()

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

Create a new fitter instance.

Definition at line 131 of file TrackFitter.h.

136 :
137 m_measurementAdder(storeArrayNameOfPXDHits, storeArrayNameOfSVDHits, storeArrayNameOfCDCHits,
138 storeArrayNameOfBKLMHits, storeArrayNameOfEKLMHits, initializeCDCTranslators)
139 {
140 if (Environment::Instance().isCosmicRun()) {
141 // Resetting with parameters for cosmics data
143 } else {
144 // Resetting with parameters for beam data
146 }
147 }
static Environment & Instance()
Static method to get a reference to the Environment instance.
Definition: Environment.cc:28
void resetFitterToDBSettings()
Use the DB settings of the fitter to fit the reco tracks.
Definition: TrackFitter.cc:138
MeasurementAdder m_measurementAdder
The measurement adder algorithm class.
Definition: TrackFitter.h:322
void resetFitterToCosmicsSettings()
Use the settings of the fitter to fit the reco tracks for cosmics data.
Definition: TrackFitter.cc:172

Member Function Documentation

◆ createCorrectPDGCodeForChargedStable()

int createCorrectPDGCodeForChargedStable ( const Const::ChargedStable particleType,
const RecoTrack recoTrack 
)
static

Helper function to multiply the PDG code of a charged stable with the charge of the reco track (if needed)

Definition at line 24 of file TrackFitter.cc.

25{
26 int currentPdgCode = particleType.getPDGCode();
27
28 const auto& pdgParticleCharge = particleType.getParticlePDG()->Charge();
29 const auto& recoTrackCharge = recoTrack.getChargeSeed();
30
31 // Copy from GenfitterModule
32 B2ASSERT("Charge of candidate and PDG particle don't match. (Code assumes |q| = 1).",
33 fabs(pdgParticleCharge) == fabs(recoTrackCharge * 3.0));
34
35 /*
36 * Because the charged stable particles do describe a positive as well as a negative particle,
37 * we have to correct the charge if needed.
38 */
39 if (std::signbit(pdgParticleCharge) != std::signbit(recoTrackCharge))
40 currentPdgCode *= -1;
41
42 return currentPdgCode;
43}
int getPDGCode() const
PDG code.
Definition: Const.h:473
const TParticlePDG * getParticlePDG() const
Accessor for ROOT TParticlePDG object.
Definition: UnitConst.cc:351
short int getChargeSeed() const
Return the charge seed stored in the reco track. ATTENTION: This is not the fitted charge.
Definition: RecoTrack.h:508

◆ fit() [1/4]

bool fit ( RecoTrack recoTrack,
bool  resortHits = false 
) const

Fit a reco track with the already present cardinal representation or with pion as default.

If the cardinal particle hypothesis is already in the track representation list and the hit content did not change (the dirty flag is set to false), the track is not refitted. If you still want to refit the track, set the dirty flag.

Internally, a new track representation with the given particle hypothesis is created and added to the reco track, if not already present. For this, a RKTrackRep is used as a base class. The PDG-code-sign is deduced from the reco track charge.

If resortHits is True, the hits are resorted while fitting (e.g. using the the track length) if the underlying fitter supports it.

Return bool if the track was successful.

Definition at line 45 of file TrackFitter.cc.

46{
47 if (not recoTrack.getRepresentations().empty() and recoTrack.getCardinalRepresentation()) {
48 return fit(recoTrack, recoTrack.getCardinalRepresentation(), resortHits);
49 } else {
50 return fit(recoTrack, Const::pion, resortHits);
51 }
52}
static const ChargedStable pion
charged pion particle
Definition: Const.h:661
const std::vector< genfit::AbsTrackRep * > & getRepresentations() const
Return a list of track representations. You are not allowed to modify or delete them!
Definition: RecoTrack.h:638
genfit::AbsTrackRep * getCardinalRepresentation() const
Get a pointer to the cardinal track representation. You are not allowed to modify or delete it!
Definition: RecoTrack.h:631
bool fit(RecoTrack &recoTrack, genfit::AbsTrackRep *trackRepresentation, bool resortHits=false) const
Fit a reco track with a given non-default track representation.
Definition: TrackFitter.cc:108

◆ fit() [2/4]

bool fit ( RecoTrack recoTrack,
const Const::ChargedStable particleType,
bool  resortHits = false 
) const

Fit a reco track with the given particle hypothesis, or with pion as default.

If the particle hypothesis is already in the track representation list and the hit content did not change (the dirty flag is set to false), the track is not refitted. If you still want to refit the track, set the dirty flag.

Internally, a new track representation with the given particle hypothesis is created and added to the reco track, if not already present. For this, a RKTrackRep is used as a base class. The PDG-code-sign is deduced from the reco track charge.

If resortHits is True, the hits are resorted while fitting (e.g. using the the track length) if the underlying fitter supports it.

Return bool if the track was successful.

Definition at line 54 of file TrackFitter.cc.

55{
56 const int currentPdgCode = TrackFitter::createCorrectPDGCodeForChargedStable(particleType, recoTrack);
57 genfit::AbsTrackRep* trackRepresentation = RecoTrackGenfitAccess::createOrReturnRKTrackRep(recoTrack,
58 currentPdgCode);
59
60 return fit(recoTrack, trackRepresentation, resortHits);
61}
static genfit::AbsTrackRep * createOrReturnRKTrackRep(RecoTrack &recoTrack, int PDGcode)
Checks if a TrackRap for the PDG id of the RecoTrack (and its charge conjugate) does already exit and...
Definition: RecoTrack.cc:409
static int createCorrectPDGCodeForChargedStable(const Const::ChargedStable &particleType, const RecoTrack &recoTrack)
Helper function to multiply the PDG code of a charged stable with the charge of the reco track (if ne...
Definition: TrackFitter.cc:24

◆ fit() [3/4]

bool fit ( RecoTrack recoTrack,
const int  pdgCode,
bool  resortHits = false 
) const

Same as above, but hypothesis set by pdg code.

Definition at line 63 of file TrackFitter.cc.

64{
65 genfit::AbsTrackRep* trackRepresentation = RecoTrackGenfitAccess::createOrReturnRKTrackRep(recoTrack,
66 pdgCode);
67
68 return fit(recoTrack, trackRepresentation, resortHits);
69}

◆ fit() [4/4]

bool fit ( RecoTrack recoTrack,
genfit::AbsTrackRep *  trackRepresentation,
bool  resortHits = false 
) const

Fit a reco track with a given non-default track representation.

You have to use a pointer to a track representation already in the reco track (use recoTrack.getRepresentations() to get a list of pointers).

If hit content did not change (indicated by the dirty flag of the reco track), the track will not be refitted.

If resortHits is True, the hits are resorted while fitting (e.g. using the the track length) if the underlying fitter supports it.

This fit function is only to be used for non-standard expert use. For the typical use case, please use the other fit function.

Return bool if the track was successful.

Definition at line 108 of file TrackFitter.cc.

109{
110 B2ASSERT("No fitter was loaded! Have you reset the fitter to an invalid one?", m_fitter);
111
112 const bool measurementAdderNeedsTrackRefit = m_measurementAdder.addMeasurements(recoTrack);
113
114 if (RecoTrackGenfitAccess::getGenfitTrack(recoTrack).getNumPoints() == 0) {
115 B2WARNING("No track points (measurements) were added to this reco track. Have you used an invalid measurement adder?");
116 return false;
117 }
118
119 const std::vector<genfit::AbsTrackRep*>& trackRepresentations = recoTrack.getRepresentations();
120 if (std::find(trackRepresentations.begin(), trackRepresentations.end(), trackRepresentation) == trackRepresentations.end()) {
121 B2FATAL("The TrackRepresentation provided is not part of the Reco Track.");
122 }
123
124 if (not recoTrack.getDirtyFlag() and not m_skipDirtyCheck and not measurementAdderNeedsTrackRefit
125 and recoTrack.hasTrackFitStatus(trackRepresentation) and recoTrack.getTrackFitStatus(trackRepresentation)->isFitted()) {
126 B2DEBUG(100, "Hit content did not change, track representation is already present and you used only default parameters." <<
127 "I will not fit the track again. If you still want to do so, set the dirty flag of the track.");
128 return recoTrack.wasFitSuccessful(trackRepresentation);
129 }
130
131 const auto previousSetting = gErrorIgnoreLevel; // Save current log level
132 gErrorIgnoreLevel = m_gErrorIgnoreLevel; // Set the log level defined in the TrackFitter
133 auto fitWithoutCheckResult = fitWithoutCheck(recoTrack, *trackRepresentation, resortHits);
134 gErrorIgnoreLevel = previousSetting; // Restore previous setting
135 return fitWithoutCheckResult;
136}
bool addMeasurements(RecoTrack &recoTrack) const
After you have filled the internal storage with measurement creators (either by providing your own or...
static genfit::Track & getGenfitTrack(RecoTrack &recoTrack)
Give access to the RecoTrack's genfit::Track.
Definition: RecoTrack.cc:404
bool wasFitSuccessful(const genfit::AbsTrackRep *representation=nullptr) const
Returns true if the last fit with the given representation was successful.
Definition: RecoTrack.cc:336
bool hasTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Check, if there is a fit status for the given representation or for the cardinal one.
Definition: RecoTrack.cc:543
bool getDirtyFlag() const
This returns true, if a hit was added after the last fit and measurement creation and a refit should ...
Definition: RecoTrack.h:715
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
Definition: RecoTrack.h:621
bool fitWithoutCheck(RecoTrack &recoTrack, const genfit::AbsTrackRep &trackRepresentation, bool resortHits=false) const
Helper function to do the fit.
Definition: TrackFitter.cc:71
Int_t m_gErrorIgnoreLevel
Control the output level of the ROOT functions used by the GenFit fitter. Default is increased from k...
Definition: TrackFitter.h:325
std::shared_ptr< genfit::AbsFitter > m_fitter
The internal storage of the used fitting algorithms.
Definition: TrackFitter.h:316
bool m_skipDirtyCheck
Flag to skip the dirty flag check which is needed when using non-default fitters.
Definition: TrackFitter.h:319

◆ fitWithoutCheck()

bool fitWithoutCheck ( RecoTrack recoTrack,
const genfit::AbsTrackRep &  trackRepresentation,
bool  resortHits = false 
) const
private

Helper function to do the fit.

This function will neither check the dirty flag nor if the track representation is added to the trackrep list of the reco track. This should only be called internally.

In every fit step, all track representations are fitted with genfit. The given track representation is only used for calculating the time seed for the fit. For this, the track representation needs to have the correct PDG code set (indicating the correct particle AND the correct charge).

If resortHits is True, the hits are resorted while fitting (e.g. using the the track length) if the underlying fitter supports it.

Definition at line 71 of file TrackFitter.cc.

72{
73 // Fit the track
74 try {
75 // Delete the old information to start from scratch
76 recoTrack.deleteFittedInformationForRepresentation(&trackRepresentation);
77 B2DEBUG(28, "resortHits is set to " << resortHits << " when fitting the tracks");
78 m_fitter->processTrackWithRep(&RecoTrackGenfitAccess::getGenfitTrack(recoTrack), &trackRepresentation, resortHits);
79 } catch (genfit::Exception& e) {
80 B2WARNING(e.getExcString());
81 }
82
83 recoTrack.setDirtyFlag(false);
84
85 // Do the hits synchronisation
86 const std::vector<RecoHitInformation*>& relatedRecoHitInformation = recoTrack.getRecoHitInformations();
87
88 for (RecoHitInformation* recoHitInformation : relatedRecoHitInformation) {
89 const genfit::TrackPoint* trackPoint = recoTrack.getCreatedTrackPoint(recoHitInformation);
90 if (trackPoint) {
91 genfit::KalmanFitterInfo* kalmanFitterInfo = trackPoint->getKalmanFitterInfo(&trackRepresentation);
92 if (not kalmanFitterInfo) {
93 recoHitInformation->setFlag(RecoHitInformation::RecoHitFlag::c_dismissedByFit);
94 } else {
95 std::vector<double> weights = kalmanFitterInfo->getWeights();
96 for (const double weight : weights) {
97 if (weight < 1.e-9) {
98 recoHitInformation->setFlag(RecoHitInformation::RecoHitFlag::c_dismissedByFit);
99 }
100 }
101 }
102 }
103 }
104
105 return recoTrack.wasFitSuccessful(&trackRepresentation);
106}
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
void setDirtyFlag(const bool &dirtyFlag=true)
Set to true, if you want to rebuild the measurements and do the fit independent on changes of the hit...
Definition: RecoTrack.h:722
const genfit::TrackPoint * getCreatedTrackPoint(const RecoHitInformation *recoHitInformation) const
Get a pointer to the TrackPoint that was created from this hit.
Definition: RecoTrack.cc:230
std::vector< RecoHitInformation * > getRecoHitInformations(bool getSorted=false) const
Return a list of all RecoHitInformations associated with the RecoTrack.
Definition: RecoTrack.cc:557
void deleteFittedInformationForRepresentation(const genfit::AbsTrackRep *rep)
Delete all fitted information for the given representations.
Definition: RecoTrack.cc:470

◆ getgErrorIgnoreLevel()

Int_t getgErrorIgnoreLevel ( )
inline

Return the currently set gErrorIgnoreLevel for the fitter.

Definition at line 312 of file TrackFitter.h.

312{ return m_gErrorIgnoreLevel; }

◆ resetFitter()

void resetFitter ( const std::shared_ptr< genfit::AbsFitter > &  fitter)

Set the internal storage of the fitter to a provided one, if you want to use non-default settings.

Whenever you call this function, all tracks will be automatically refitted, although they might be already fitted (because you use non-default parameters, so we assume you want other fit results).

Definition at line 180 of file TrackFitter.cc.

181{
182 m_fitter = fitter;
183 m_skipDirtyCheck = true;
184}

◆ resetFitterToCosmicsSettings()

void resetFitterToCosmicsSettings ( )

Use the settings of the fitter to fit the reco tracks for cosmics data.

This method is called on construction automatically for cosmics data (checked by using Environment object). The cosmics parameters are the initial ones of the DAFparameters constructor.

Definition at line 172 of file TrackFitter.cc.

173{
174 // The cosmics parameters are the ones from the DAFparameters constructor
175 DAFparameters* DAFparams = new DAFparameters();
176
177 resetFitterToUserSettings(DAFparams);
178}
The payload containing the DAF parameters.
Definition: DAFparameters.h:21
void resetFitterToUserSettings(DAFparameters *DAFparams)
Use the user settings of the fitter to fit the reco tracks.
Definition: TrackFitter.cc:155

◆ resetFitterToDBSettings()

void resetFitterToDBSettings ( )

Use the DB settings of the fitter to fit the reco tracks.

This method is called on construction automatically for non cosmics data (checked by using Environment object).

Definition at line 138 of file TrackFitter.cc.

139{
140 if (!m_DAFparameters.isValid())
141 B2FATAL("DAF parameters are not available.");
142 genfit::DAF* dafFitter = new genfit::DAF(m_DAFparameters->getAnnealingScheme(),
143 m_DAFparameters->getMinimumIterations(),
144 m_DAFparameters->getMaximumIterations(),
145 m_DAFparameters->getMinimumIterationsForPVal(),
146 true,
147 m_DAFparameters->getDeltaPValue(),
148 m_DAFparameters->getDeltaWeight(),
149 m_DAFparameters->getProbabilityCut());
150 dafFitter->setMaxFailedHits(m_DAFparameters->getMaximumFailedHits());
151 m_fitter.reset(dafFitter);
152 m_skipDirtyCheck = false;
153}
DBObjPtr< DAFparameters > m_DAFparameters
DAF parameters Database OjbPtr.
Definition: TrackFitter.h:328

◆ resetFitterToUserSettings()

void resetFitterToUserSettings ( DAFparameters DAFparams)

Use the user settings of the fitter to fit the reco tracks.

The parameters are passed as DAFparameters object.

Definition at line 155 of file TrackFitter.cc.

156{
157 if (DAFparams == nullptr)
158 B2FATAL("DAF parameters are not available.");
159 genfit::DAF* dafFitter = new genfit::DAF(DAFparams->getAnnealingScheme(),
160 DAFparams->getMinimumIterations(),
161 DAFparams->getMaximumIterations(),
162 DAFparams->getMinimumIterationsForPVal(),
163 true,
164 DAFparams->getDeltaPValue(),
165 DAFparams->getDeltaWeight(),
166 DAFparams->getProbabilityCut());
167 dafFitter->setMaxFailedHits(DAFparams->getMaximumFailedHits());
168 m_fitter.reset(dafFitter);
169 m_skipDirtyCheck = false;
170}
int getMaximumIterations() const
Get the maximum number of iterations of annealing scheme.
std::tuple< float, float, int > getAnnealingScheme() const
Get the start and end temperatures and number of iterations for the annealing scheme returns a tuple ...
int getMaximumFailedHits() const
Get the maximum number of failed hits after which the fit should be cancelled.
int getMinimumIterationsForPVal() const
Get the minimum number of iterations for pValue check.
float getDeltaPValue() const
Get the DeltaPValue for p-value convergence criterion.
Definition: DAFparameters.h:98
int getMinimumIterations() const
Get the minimum number of iterations of annealing scheme.
float getProbabilityCut() const
Get the probability cut for the weight calculation for the hits.
float getDeltaWeight() const
Get the DeltaWeight for weight convergence criterion.

◆ 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 
)
inline

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 259 of file TrackFitter.h.

266 {
267 m_measurementAdder.resetMeasurementCreators(pxdMeasurementCreators,
268 svdMeasurementCreators,
269 cdcMeasurementCreators,
270 bklmMeasurementCreators,
271 eklmMeasurementCreators,
272 additionalMeasurementCreators);
273 }
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 th...

◆ resetMeasurementCreatorsToDefaultSettings()

void resetMeasurementCreatorsToDefaultSettings ( )
inline

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 244 of file TrackFitter.h.

245 {
247 }
void resetMeasurementCreatorsToDefaultSettings()
Reset the internal measurement creator storage to the default settings.

◆ 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 
)
inline

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 292 of file TrackFitter.h.

299 {
301 svdMeasurementCreators,
302 cdcMeasurementCreators,
303 bklmMeasurementCreators,
304 eklmMeasurementCreators,
305 additionalMeasurementCreators);
306 }
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 th...

◆ setgErrorIgnoreLevel()

void setgErrorIgnoreLevel ( Int_t  errorIgnoreLevel)
inline

Set the gErrorIgnoreLevel for the fitter.

Definition at line 309 of file TrackFitter.h.

309{ m_gErrorIgnoreLevel = errorIgnoreLevel; }

Member Data Documentation

◆ m_DAFparameters

DBObjPtr<DAFparameters> m_DAFparameters
private

DAF parameters Database OjbPtr.

Definition at line 328 of file TrackFitter.h.

◆ m_fitter

std::shared_ptr<genfit::AbsFitter> m_fitter
private

The internal storage of the used fitting algorithms.

Definition at line 316 of file TrackFitter.h.

◆ m_gErrorIgnoreLevel

Int_t m_gErrorIgnoreLevel = kFatal
private

Control the output level of the ROOT functions used by the GenFit fitter. Default is increased from kError to kFatal;.

Definition at line 325 of file TrackFitter.h.

◆ m_measurementAdder

MeasurementAdder m_measurementAdder
private

The measurement adder algorithm class.

Definition at line 322 of file TrackFitter.h.

◆ m_skipDirtyCheck

bool m_skipDirtyCheck = false
private

Flag to skip the dirty flag check which is needed when using non-default fitters.

Definition at line 319 of file TrackFitter.h.

◆ s_defaultDeltaPValue

constexpr double s_defaultDeltaPValue = 1.0
staticconstexpr

Default deltaPValue for the default DAF fitter.

Definition at line 124 of file TrackFitter.h.

◆ s_defaultMaxFailedHits

constexpr unsigned int s_defaultMaxFailedHits = 5
staticconstexpr

Default maxFailedHits for the default DAF fitter.

Definition at line 128 of file TrackFitter.h.

◆ s_defaultProbCut

constexpr double s_defaultProbCut = 0.001
staticconstexpr

Default probCut for the default DAF fitter.

Definition at line 126 of file TrackFitter.h.


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