Skip to content

Commit

Permalink
add relChi2changeCutOff bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
AJPfleger committed Oct 26, 2023
1 parent 46d0763 commit cef6866
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ std::shared_ptr<TrackFitterFunction> makeGsfFitterFunction(
/// @param energyLoss bool
/// @param freeToBoundCorrection bool
/// @param nUpdateMax max number of iterations during the fit
/// @param zerofield disables the QoP fit in case of missing B-field
/// @param zerofield Disables the QoP fit in case of missing B-field.
/// @param relChi2changeCutOff Check for convergence (abort condition). Set to 0 to skip.
/// @param logger a logger instance
std::shared_ptr<TrackFitterFunction> makeGlobalChiSquareFitterFunction(
std::shared_ptr<const Acts::TrackingGeometry> trackingGeometry,
Expand All @@ -109,6 +110,7 @@ std::shared_ptr<TrackFitterFunction> makeGlobalChiSquareFitterFunction(
Acts::FreeToBoundCorrection freeToBoundCorrection =
Acts::FreeToBoundCorrection(),
size_t nUpdateMax = 5, bool zeroField = false,
double relChi2changeCutOff = 1e-7,
const Acts::Logger& logger = *Acts::getDefaultLogger("Gx2f",
Acts::Logging::INFO));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction {
Acts::FreeToBoundCorrection freeToBoundCorrection;
size_t nUpdateMax = 5;
bool zeroField = false;
double relChi2changeCutOff = 1e-7;

IndexSourceLink::SurfaceAccessor m_slSurfaceAccessor;

Expand All @@ -94,7 +95,7 @@ struct GlobalChiSquareFitterFunctionImpl final : public TrackFitterFunction {
options.geoContext, options.magFieldContext, options.calibrationContext,
extensions, options.propOptions, &(*options.referenceSurface),
multipleScattering, energyLoss, freeToBoundCorrection, nUpdateMax,
zeroField);
zeroField, relChi2changeCutOff);

return gx2fOptions;
}
Expand Down Expand Up @@ -131,7 +132,7 @@ ActsExamples::makeGlobalChiSquareFitterFunction(
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
bool multipleScattering, bool energyLoss,
Acts::FreeToBoundCorrection freeToBoundCorrection, size_t nUpdateMax,
bool zeroField, const Acts::Logger& logger) {
bool zeroField, double relChi2changeCutOff, const Acts::Logger& logger) {
// Stepper should be copied into the fitters
const Stepper stepper(std::move(magneticField));

Expand Down Expand Up @@ -162,6 +163,7 @@ ActsExamples::makeGlobalChiSquareFitterFunction(
fitterFunction->freeToBoundCorrection = freeToBoundCorrection;
fitterFunction->nUpdateMax = nUpdateMax;
fitterFunction->zeroField = zeroField;
fitterFunction->relChi2changeCutOff = relChi2changeCutOff;

return fitterFunction;
}
2 changes: 2 additions & 0 deletions Examples/Python/python/acts/examples/reconstruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,7 @@ def addGx2fTracks(
energyLoss: bool = False,
nUpdateMax: int = 5,
zeroField: bool = False,
relChi2changeCutOff: float = 1e-7,
clusters: str = None,
calibrator: acts.examples.MeasurementCalibrator = acts.examples.makePassThroughCalibrator(),
logLevel: Optional[acts.logging.Level] = None,
Expand All @@ -1156,6 +1157,7 @@ def addGx2fTracks(
"freeToBoundCorrection": acts.examples.FreeToBoundCorrection(False),
"nUpdateMax": nUpdateMax,
"zeroField": zeroField,
"relChi2changeCutOff": relChi2changeCutOff,
"level": customLogLevel(),
}

Expand Down
6 changes: 3 additions & 3 deletions Examples/Python/src/TrackFitting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,16 @@ void addTrackFitting(Context& ctx) {
std::shared_ptr<const Acts::MagneticFieldProvider> magneticField,
bool multipleScattering, bool energyLoss,
Acts::FreeToBoundCorrection freeToBoundCorrection, size_t nUpdateMax,
bool zeroField, Logging::Level level) {
bool zeroField, double relChi2changeCutOff, Logging::Level level) {
return ActsExamples::makeGlobalChiSquareFitterFunction(
trackingGeometry, magneticField, multipleScattering, energyLoss,
freeToBoundCorrection, nUpdateMax, zeroField,
freeToBoundCorrection, nUpdateMax, zeroField, relChi2changeCutOff,
*Acts::getDefaultLogger("Gx2f", level));
},
py::arg("trackingGeometry"), py::arg("magneticField"),
py::arg("multipleScattering"), py::arg("energyLoss"),
py::arg("freeToBoundCorrection"), py::arg("nUpdateMax"),
py::arg("zeroField"), py::arg("level"));
py::arg("zeroField"), py::arg("relChi2changeCutOff"), py::arg("level"));
}

{
Expand Down
1 change: 1 addition & 0 deletions Examples/Scripts/Python/truth_tracking_gx2f.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def runTruthTrackingGx2f(
trackingGeometry,
field,
nUpdateMax=17,
relChi2changeCutOff=1e-7,
)

# Output
Expand Down

0 comments on commit cef6866

Please sign in to comment.