ATLAS Offline Software
Loading...
Searching...
No Matches
MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor Class Reference

Propagator Actor plugin for the GX2F. More...

Collaboration diagram for MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor:

Public Types

using result_type = Gx2FitterResult<traj_t>
 Broadcast the result_type.
using TrackStateProxy_t = typename traj_t::TrackStateProxy

Public Member Functions

const Logger & logger () const
 Logger helper.
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > act (propagator_state_t &state, const stepper_t &stepper, const navigator_t &navigator, result_type &result, const Logger &) const
 Gx2f actor operation.
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > makeTrackState (propagator_state_t &state, const stepper_t &stepper, const navigator_t &navigator, result_type &result) const
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > fillMaterialMap (propagator_state_t &state, const stepper_t &stepper, const navigator_t &navigator, result_type &result) const
template<typename propagator_state_t, typename stepper_t, typename navigator_t, typename result_t>
bool checkAbort (propagator_state_t &, const stepper_t &, const navigator_t &, const result_t &result, const Logger &) const

Public Attributes

const std::unordered_map< const Surface *, SourceLink > * inputMeasurements {}
 Allows retrieving measurements for a surface.
bool doMultipleScattering = false
 Whether to consider multiple scattering.
bool doEnergyLoss = false
 Whether to consider energy loss.
double scatteringCutOff = 0.
double elossCutOff = 0.
 Cutoff value on the energy loss to fine tune the number of energy loss parameters in the fit.
FreeToBoundCorrection freeToBoundCorrection
 Whether to include non-linear correction during global to local transformation.
const Logger * actorLogger {nullptr}
 The logger instance.
Gx2FitterExtensions< traj_t > extensions
const CalibrationContext * calibrationContext {nullptr}
 Calibration context for the fit.
const BoundTrackParameters * startParameters = nullptr
 Start parameters of the track fit.

Detailed Description

template<typename propagator_t, typename traj_t>
class MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor

Propagator Actor plugin for the GX2F.

Template Parameters
parameters_tThe type of parameters used for "local" parameters.
calibrator_tThe type of calibrator
outlier_finder_tType of the outlier finder class

The GX2F Actor does not rely on the measurements to be sorted along the track.

Definition at line 754 of file Chi2Fitter.h.

Member Typedef Documentation

◆ result_type

template<typename propagator_t, typename traj_t>
using MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::result_type = Gx2FitterResult<traj_t>

Broadcast the result_type.

Definition at line 757 of file Chi2Fitter.h.

◆ TrackStateProxy_t

template<typename propagator_t, typename traj_t>
using MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::TrackStateProxy_t = typename traj_t::TrackStateProxy

Definition at line 759 of file Chi2Fitter.h.

Member Function Documentation

◆ act()

template<typename propagator_t, typename traj_t>
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::act ( propagator_state_t & state,
const stepper_t & stepper,
const navigator_t & navigator,
result_type & result,
const Logger &  ) const
inline

Gx2f actor operation.

Template Parameters
propagator_state_tis the type of Propagator state
stepper_tType of the stepper
navigator_tType of the navigator
Parameters
stateis the mutable propagator state object
stepperThe stepper in use
navigatorThe navigator in use
resultis the mutable result state object

Definition at line 806 of file Chi2Fitter.h.

808 {
809 assert(result.fittedStates && "No MultiTrajectory set");
810
811 // Check if we can stop to propagate
812 if (result.measurementStates == inputMeasurements->size()) {
813 ACTS_DEBUG("Actor: finish: All measurements have been found.");
814 result.finished = true;
815 } else if (state.navigation.navigationBreak) {
816 ACTS_DEBUG("Actor: finish: navigationBreak.");
817 result.finished = true;
818 }
819
820 // End the propagation and return to the fitter
821 if (result.finished) {
822 // Remove the missing surfaces that occur after the last measurement
823 if (result.measurementStates > 0) {
824 result.missedActiveSurfaces.resize(result.measurementHoles);
825 }
826
827 return Result<void>::success();
828 }
829
830 // We are only interested in surfaces. If we are not on a surface, we
831 // continue the navigation
832 const Surface* surface = navigator.currentSurface(state.navigation);
833 if (surface == nullptr) {
834 return Result<void>::success();
835 }
836
837 ++result.surfaceCount;
838 const GeometryIdentifier geoId = surface->geometryId();
839 ACTS_DEBUG("Surface "
840 << geoId << ", " << surface->bounds() << " detected. "
841 << "Sensitive: " << (surface->isSensitive() ? "yes" : "no")
842 << ", has material: "
843 << (surface->hasMaterial() ? "yes" : "no"));
844
846 if (!matFillResult.ok()) {
847 return matFillResult.error();
848 }
849
851 if (!trackStateResult.ok()) {
852 return trackStateResult.error();
853 }
854 // Here we handle all measurements
855 if (auto sourceLinkIt = inputMeasurements->find(surface);
857 // We count the processed measurement
858 ++result.processedMeasurements;
859
860 result.lastMeasurementIndex = result.lastTrackIndex;
861
862 // TODO check for outlier first
863 // We count the state with measurement
864 ++result.measurementStates;
865
866 // We count the processed state
867 ++result.processedStates;
868
869 // Update the number of holes count only when encountering a
870 // measurement
871 result.measurementHoles = result.missedActiveSurfaces.size();
872
873 return Result<void>::success();
874 }
875
876 ACTS_DEBUG(" The surface contains no measurement/material/hole.");
877 return Result<void>::success();
878 }
Result< void > fillMaterialMap(propagator_state_t &state, const stepper_t &stepper, const navigator_t &navigator, result_type &result) const
Definition Chi2Fitter.h:989
Result< void > makeTrackState(propagator_state_t &state, const stepper_t &stepper, const navigator_t &navigator, result_type &result) const
Definition Chi2Fitter.h:882
const std::unordered_map< const Surface *, SourceLink > * inputMeasurements
Allows retrieving measurements for a surface.
Definition Chi2Fitter.h:762
Global Chi Square fitter (GX2F) implementation.
Definition Chi2Fitter.h:713

◆ checkAbort()

template<typename propagator_t, typename traj_t>
template<typename propagator_state_t, typename stepper_t, typename navigator_t, typename result_t>
bool MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::checkAbort ( propagator_state_t & ,
const stepper_t & ,
const navigator_t & ,
const result_t & result,
const Logger &  ) const
inline

Definition at line 1132 of file Chi2Fitter.h.

1134 {
1135 return result.finished;
1136 }

◆ fillMaterialMap()

template<typename propagator_t, typename traj_t>
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::fillMaterialMap ( propagator_state_t & state,
const stepper_t & stepper,
const navigator_t & navigator,
result_type & result ) const
inline
Template Parameters
propagator_state_tis the type of Propagator state
stepper_tType of the stepper
navigator_tType of the navigator
Parameters
stateis the mutable propagator state object
stepperThe stepper in use
navigatorThe navigator in use
resultis the mutable result state object

Entry is already present. Nothing to be done

There is measurement of the energy loss but the surface material is good. Calculate the expected energy loss from Bethe-Bloch.

Energy loss uncertainty

Accumulate the material across surfaces

Definition at line 989 of file Chi2Fitter.h.

992 {
996 << " | "
997 << "Multiple scattering and energy loss are disabled. Returning");
998 return Result<void>::success();
999 }
1000 const Surface* surface = navigator.currentSurface(state.navigation);
1001 if (!surface->hasMaterial()) {
1002 return Result<void>::success();
1003 }
1004
1005 // Found material - add a scatteringAngles entry if not done yet and
1006 // energy loss if enabled. Handling will happen later
1007 ACTS_DEBUG(" The surface contains material ...");
1008
1009 const GeometryIdentifier geoId = surface->geometryId();
1010 auto materialMapId = result.materialMap.find(geoId);
1012
1013 if (materialMapId != result.materialMap.end()) {
1014 ACTS_VERBOSE(" .... entry is already in the material map.");
1015 if (materialMapId->second.nDim() == 0ul) {
1016 ACTS_VERBOSE(" Material surface "
1017 << geoId
1018 << " has zero dimension - do not keep the index.");
1019 return Result<void>::success();
1020 }
1021 result.materialParamIndices.push_back(
1022 result.materialParamIndices.back() + materialMapId->second.nDim());
1023 return Result<void>::success();
1024 }
1025
1026 ACTS_DEBUG(" ... create entry in material map.");
1027
1033 if (!slabResult.ok()) {
1034 ACTS_DEBUG(__func__ << " | "
1035 << "Failed to evaluate material slab: "
1036 << slabResult.error());
1037 return Result<void>::failure(slabResult.error());
1038 }
1039 const MaterialSlab& slab = *slabResult;
1040 const bool goodSlab = !slab.isVacuum();
1041
1044
1047
1048 if (goodSlab) {
1049 const auto& particle = startParameters->particleHypothesis();
1050
1051 const double sigma =
1052 static_cast<double>(Acts::computeMultipleScatteringTheta0(
1053 slab, particle.absolutePdg(), particle.mass(),
1054 static_cast<float>(startParameters->parameters()[eBoundQOverP]),
1055 particle.absoluteCharge()));
1056 ACTS_VERBOSE(" The Highland formula gives sigma = " << sigma);
1057
1059
1060 } else {
1061 ACTS_VERBOSE(" Material slab is not valid.");
1062 }
1063
1064 if (doEnergyLoss) {
1065 eLoss = extensions.elossAccumulator(
1066 state.geoContext, *calibrationContext,
1067 stepper.position(state.stepping), stepper.direction(state.stepping),
1068 *surface);
1071 if (!eLoss.isValid() && goodSlab) {
1072 const auto& particle = startParameters->particleHypothesis();
1073
1074 const double qOverP = stepper.qOverP(state.stepping);
1075 ACTS_VERBOSE("The particle has momentum "
1076 << (1. / qOverP) * particle.absoluteCharge()
1077 << " and charge " << particle.absoluteCharge());
1078
1080 computeEnergyLossMean(slab, particle.absolutePdg(),
1081 particle.mass(), qOverP,
1082 particle.absoluteCharge()),
1084 static_cast<double>(Acts::computeEnergyLossLandauSigma(
1085 slab, particle.mass(), static_cast<float>(qOverP),
1086 particle.absoluteCharge()))};
1087
1088 ACTS_VERBOSE(" The Bethe-Bloch formula gives energy loss "
1089 << eLoss.lostEnergy() << " with uncertainty "
1090 << eLoss.lostSigma());
1091 }
1092 }
1093
1095 scatterer += result.accScatterer;
1096 eLoss += result.accEloss;
1097 if (scatterer.sigma() < scatteringCutOff) {
1098 result.accScatterer = std::move(scatterer);
1100 } else {
1101 result.accScatterer = ScatteringAtSurface{};
1102 }
1103
1104 if (eLoss.lostEnergy() < elossCutOff) {
1105 result.accEloss = std::move(eLoss);
1107 } else {
1108 result.accEloss = ELossAtSurface{};
1109 }
1110 ACTS_DEBUG(" ... add entry in material map with scattering "
1111 << scatterer.sigma() << " and energy loss "
1112 << eLoss.lostEnergy());
1114 result.materialMap
1116 std::move(eLoss)})
1117 .first;
1118 if (materialMapId->second.nDim() == 0ul) {
1119 ACTS_VERBOSE(" Material surface "
1120 << geoId
1121 << " has zero dimension - do not keep the index.");
1122 return Result<void>::success();
1123 }
1124 result.materialParamIndices.push_back(result.materialParamIndices.back() +
1125 materialMapId->second.nDim());
1126
1127 return Result<void>::success();
1128 }
const CalibrationContext * calibrationContext
Calibration context for the fit.
Definition Chi2Fitter.h:788
double elossCutOff
Cutoff value on the energy loss to fine tune the number of energy loss parameters in the fit.
Definition Chi2Fitter.h:774
const BoundTrackParameters * startParameters
Start parameters of the track fit.
Definition Chi2Fitter.h:792
Gx2FitterExtensions< traj_t > extensions
Definition Chi2Fitter.h:785
bool doMultipleScattering
Whether to consider multiple scattering.
Definition Chi2Fitter.h:765
bool doEnergyLoss
Whether to consider energy loss.
Definition Chi2Fitter.h:768

◆ logger()

template<typename propagator_t, typename traj_t>
const Logger & MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::logger ( ) const
inline

Logger helper.

Definition at line 783 of file Chi2Fitter.h.

783{ return *actorLogger; }
const Logger * actorLogger
The logger instance.
Definition Chi2Fitter.h:780

◆ makeTrackState()

template<typename propagator_t, typename traj_t>
template<typename propagator_state_t, typename stepper_t, typename navigator_t>
Result< void > MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::makeTrackState ( propagator_state_t & state,
const stepper_t & stepper,
const navigator_t & navigator,
result_type & result ) const
inline

The surface is neither sensitive or it carries material

There is no material update

Definition at line 882 of file Chi2Fitter.h.

885 {
886 const Surface* surface = navigator.currentSurface(state.navigation);
887
888 const GeometryIdentifier geoId = surface->geometryId();
889
891 auto materialItr = result.materialMap.find(geoId);
892 const bool isSensitive =
893 surface->isSensitive() || sourceLinkIt != inputMeasurements->end();
894 const bool hasMaterial = surface->hasMaterial() &&
895 materialItr != result.materialMap.end() &&
896 materialItr->second.materialIsValid();
898 if (!isSensitive && !hasMaterial) {
899 return Result<void>::success();
900 }
901
902 auto& fittedStates = *result.fittedStates;
903
904 // Add a <trackStateMask> TrackState entry multi trajectory. This
905 // allocates storage for all components, which we will set later.
907 Gx2fConstants::trackStateMask, result.lastTrackIndex);
908
909 result.lastTrackIndex = trackStateProxy.index();
910
911 auto typeFlags = trackStateProxy.typeFlags();
912 typeFlags.setHasParameters();
913
914 // Transport the covariance to the surface
915 auto transportRes = stepper.transportToBound(
917 if (!transportRes.ok()) {
918 return transportRes.error();
919 }
920
921 // Set the trackStateProxy components with the state from the ongoing
922 // propagation
923 trackStateProxy.setReferenceSurface(surface->getSharedPtr());
924
925 // Not const since, we might need to update with scattering angles
926 auto res = stepper.boundParameters(state.stepping, *surface);
927 if (!res.ok()) {
928 return res.error();
929 }
930 // Not const since, we might need to update with scattering angles
931 auto& boundParams = *res;
932
933 trackStateProxy.smoothedCovariance() = stepper.covariance(state.stepping).value();
934 trackStateProxy.jacobian() = *transportRes;
935 trackStateProxy.pathLength() = stepper.pathLength(state.stepping);
936
938 if (hasMaterial) {
939 typeFlags.setHasMaterial();
940
941 // track
942 ACTS_DEBUG(" Update parameters with material effects.");
943 ACTS_VERBOSE(" boundParams before the update: "
944 << boundParams.parameters().transpose());
945
946 materialItr->second.updateTrackParameters(boundParams);
947 ACTS_VERBOSE(" boundParams after the update: "
948 << boundParams.parameters().transpose());
949
950 stepper.update(state.stepping,
952 trackStateProxy.referenceSurface(), state.geoContext,
953 boundParams.parameters()),
954 boundParams.parameters(),
955 trackStateProxy.smoothedCovariance(), *surface);
956 }
957
958 // Fill the track state
959 trackStateProxy.smoothed() = boundParams.parameters();
960 if (!isSensitive) {
961 return Result<void>::success();
962 }
963
964 if (sourceLinkIt == inputMeasurements->end()) {
965 typeFlags.setIsHole();
966 return Result<void>::success();
967 }
968 typeFlags.setIsMeasurement();
969
970 // We have smoothed parameters, so calibrate the uncalibrated input
971 // measurement
972 extensions.calibrator(state.geoContext, *calibrationContext,
974
975 return Result<void>::success();
976 }
FreeToBoundCorrection freeToBoundCorrection
Whether to include non-linear correction during global to local transformation.
Definition Chi2Fitter.h:778
typename traj_t::TrackStateProxy TrackStateProxy_t
Definition Chi2Fitter.h:759

Member Data Documentation

◆ actorLogger

template<typename propagator_t, typename traj_t>
const Logger* MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::actorLogger {nullptr}

The logger instance.

Definition at line 780 of file Chi2Fitter.h.

780{nullptr};

◆ calibrationContext

template<typename propagator_t, typename traj_t>
const CalibrationContext* MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::calibrationContext {nullptr}

Calibration context for the fit.

Definition at line 788 of file Chi2Fitter.h.

788{nullptr};

◆ doEnergyLoss

template<typename propagator_t, typename traj_t>
bool MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::doEnergyLoss = false

Whether to consider energy loss.

Definition at line 768 of file Chi2Fitter.h.

◆ doMultipleScattering

template<typename propagator_t, typename traj_t>
bool MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::doMultipleScattering = false

Whether to consider multiple scattering.

Definition at line 765 of file Chi2Fitter.h.

◆ elossCutOff

template<typename propagator_t, typename traj_t>
double MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::elossCutOff = 0.

Cutoff value on the energy loss to fine tune the number of energy loss parameters in the fit.

Definition at line 774 of file Chi2Fitter.h.

◆ extensions

template<typename propagator_t, typename traj_t>
Gx2FitterExtensions<traj_t> MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::extensions

Definition at line 785 of file Chi2Fitter.h.

◆ freeToBoundCorrection

template<typename propagator_t, typename traj_t>
FreeToBoundCorrection MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::freeToBoundCorrection

Whether to include non-linear correction during global to local transformation.

Definition at line 778 of file Chi2Fitter.h.

◆ inputMeasurements

template<typename propagator_t, typename traj_t>
const std::unordered_map<const Surface*, SourceLink>* MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::inputMeasurements {}

Allows retrieving measurements for a surface.

Definition at line 762 of file Chi2Fitter.h.

762{};

◆ scatteringCutOff

template<typename propagator_t, typename traj_t>
double MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::scatteringCutOff = 0.

Definition at line 770 of file Chi2Fitter.h.

◆ startParameters

template<typename propagator_t, typename traj_t>
const BoundTrackParameters* MuonExperimental::Gx2Fitter< propagator_t, traj_t >::GX2FActor::startParameters = nullptr

Start parameters of the track fit.

The hypothesis is needed to estimate the material effects

Definition at line 792 of file Chi2Fitter.h.


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