ATLAS Offline Software
Loading...
Searching...
No Matches
GlobalChi2Fitter.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef GLOBALCHI2FITTER_H
6#define GLOBALCHI2FITTER_H
7
11#include "GaudiKernel/ToolHandle.h"
12#include "GaudiKernel/EventContext.h"
13
14
20
27
29
36
39
42
43#include <memory>
44#include <mutex>
45
138
139class AtlasDetectorID;
140
141
142namespace Trk {
143 class Track;
144 class IMagneticFieldTool;
145 class MeasuredPerigee;
149 class Layer;
150 class CylinderLayer;
151 class DiscLayer;
153 class TrackingVolume;
154 class Volume;
155
156 class GlobalChi2Fitter: public extends<AthCheckedComponent<AthAlgTool>, IGlobalTrackFitter> {
158 std::unique_ptr<const TrackParameters> m_parameters;
159 std::optional<TransportJacobian> m_jacobian;
160 std::optional<std::vector<std::unique_ptr<TrackParameters>>> m_preholes;
161 };
162
163 /*
164 * This struct serves as a very simple container for the five different
165 * hole and dead module states that we want to count, which are the dead
166 * Pixels, dead SCTs, Pixel holes, SCT holes, and SCT double holes.
167 */
169 unsigned int m_pixel_hole = 0;
170 unsigned int m_sct_hole = 0;
171 unsigned int m_sct_double_hole = 0;
172 unsigned int m_pixel_dead = 0;
173 unsigned int m_sct_dead = 0;
174 };
175
188
189 struct Cache {
190 /*
191 * Currently the information about what type of fit is being passed by the
192 * presence of a TrackingVolume.
193 */
194 template <class T>
195 static
196 void objVectorDeleter(const std::vector<const T *> *ptr) {
197 if (ptr) {
198 for (const T *elm : *ptr) { delete elm; }
199 delete ptr;
200 }
201 }
202
205 const TrackingVolume *m_msEntrance = nullptr;
206
208 bool m_idmat = true;
209 bool m_sirecal{};
212 bool m_matfilled = false;
216
217 std::vector<double> m_phiweight;
218 std::vector<int> m_firstmeasurement;
219 std::vector<int> m_lastmeasurement;
220
221 std::vector < const Trk::Layer * >m_negdiscs;
222 std::vector < const Trk::Layer * >m_posdiscs;
223 std::vector < const Trk::Layer * >m_barrelcylinders;
224
225 bool m_fastmat = true;
226
229
232
233 std::vector< std::unique_ptr< const std::vector < const TrackStateOnSurface *>,
234 void (*)(const std::vector<const TrackStateOnSurface *> *) > >
236
238
240
241 std::array<unsigned int, S_MAX_VALUE> m_fit_status {};
242 std::array<std::atomic<unsigned int>, S_MAX_VALUE> *m_fit_status_out = nullptr;
243
244 Cache(const GlobalChi2Fitter *fitter):
245 m_calomat(fitter->m_calomat),
246 m_extmat(fitter->m_extmat),
247 m_sirecal(fitter->m_sirecal),
249 m_reintoutl(fitter->m_reintoutl),
251 m_fiteloss(fitter->m_fiteloss),
252 m_asymeloss(fitter->m_asymeloss),
253 m_miniter(fitter->m_miniter),
255 {}
257 unsigned int idx=0;
258 for (unsigned int a_fit_status : m_fit_status) {
259 if (a_fit_status) {
260 (*m_fit_status_out)[idx] += a_fit_status;
261 }
262 ++idx;
263 }
264 }
265
266 Cache & operator=(const Cache &) = delete;
267
269 m_fit_status[status]++;
270 }
271 };
272
273 public:
275 const std::string &,
276 const std::string &,
277 const IInterface *
278 );
279
280 virtual ~ GlobalChi2Fitter();
281
282 virtual StatusCode initialize() override;
283 virtual StatusCode finalize() override;
284
285 virtual std::unique_ptr<Track> fit(
286 const EventContext& ctx,
287 const PrepRawDataSet&,
288 const TrackParameters&,
289 const RunOutlierRemoval runOutlier = false,
290 const ParticleHypothesis matEffects = nonInteracting
291 ) const override final;
292
293 virtual std::unique_ptr<Track> fit(
294 const EventContext& ctx,
295 const Track &,
296 const RunOutlierRemoval runOutlier = false,
297 const ParticleHypothesis matEffects = nonInteracting
298 ) const override final;
299
300 virtual std::unique_ptr<Track> fit(
301 const EventContext& ctx,
302 const MeasurementSet &,
303 const TrackParameters &,
304 const RunOutlierRemoval runOutlier = false,
305 const ParticleHypothesis matEffects = nonInteracting
306 ) const override final;
307
308 virtual std::unique_ptr<Track> fit(
309 const EventContext& ctx,
310 const Track &,
311 const PrepRawDataSet &,
312 const RunOutlierRemoval runOutlier = false,
313 const ParticleHypothesis matEffects = nonInteracting
314 ) const override final;
315
316 virtual std::unique_ptr<Track> fit(
317 const EventContext& ctx,
318 const Track &,
319 const Track &,
320 const RunOutlierRemoval runOutlier = false,
321 const ParticleHypothesis matEffects = nonInteracting
322 ) const override final;
323
324 virtual std::unique_ptr<Track> fit(
325 const EventContext& ctx,
326 const Track &,
327 const MeasurementSet &,
328 const RunOutlierRemoval runOutlier = false,
329 const ParticleHypothesis matEffects = nonInteracting
330 ) const override final;
331
332 virtual Track* alignmentFit(
333 const EventContext& ctx,
334 AlignmentCache&,
335 const Track&,
336 const RunOutlierRemoval runOutlier=false,
338 ) const override;
339
340 private:
341
342 Track * fitIm(
343 const EventContext& ctx,
344 Cache & cache,
345 const Track & inputTrack,
346 const RunOutlierRemoval runOutlier,
347 const ParticleHypothesis matEffects
348 ) const;
349
350 Track *myfit(
351 const EventContext& ctx,
352 Cache &,
354 const TrackParameters &,
355 const RunOutlierRemoval runOutlier = false,
356 const ParticleHypothesis matEffects = nonInteracting
357 ) const;
358
360 Cache &,
362 const TrackParameters &,
363 const RunOutlierRemoval runOutlier = false,
364 const ParticleHypothesis matEffects = nonInteracting
365 ) const;
366
368 const EventContext& ctx,
369 Cache &,
370 const Track &,
371 const Track &,
373 std::vector<MaterialEffectsOnTrack> &
374 ) const;
375
377 const EventContext& ctx,
378 Cache &,
379 const Track &,
380 const Track &,
382 std::vector<MaterialEffectsOnTrack> &
383 ) const;
384
385 void makeProtoState(
386 Cache &,
388 const TrackStateOnSurface *,
389 int index = -1
390 ) const;
391
393 Cache &,
395 const MeasurementBase *,
396 const TrackParameters * trackpar = nullptr,
397 bool isoutlier = false,
398 int index = -1
399 ) const;
400
401 bool processTrkVolume(
402 Cache &,
403 const Trk::TrackingVolume * tvol
404 ) const;
405
431 static std::optional<std::pair<Amg::Vector3D, double>> addMaterialFindIntersectionDisc(
432 Cache & cache,
433 const DiscSurface & surface,
434 const TrackParameters & param1,
435 const TrackParameters & param2,
436 const ParticleHypothesis mat
437 ) ;
438
448 static std::optional<std::pair<Amg::Vector3D, double>> addMaterialFindIntersectionCyl(
449 Cache & cache,
450 const CylinderSurface & surface,
451 const TrackParameters & param1,
452 const TrackParameters & param2,
453 const ParticleHypothesis mat
454 ) ;
455
477 Cache & cache,
478 GXFTrajectory & track,
479 int offset,
480 std::vector<std::pair<const Layer *, const Layer *>> & layers,
481 const TrackParameters * ref1,
482 const TrackParameters * ref2,
484 ) const;
485
507 static void addMaterialGetLayers(
508 Cache & cache,
509 std::vector<std::pair<const Layer *, const Layer *>> & layers,
510 std::vector<std::pair<const Layer *, const Layer *>> & uplayers,
511 const std::vector<std::unique_ptr<GXFTrackState>> & states,
512 GXFTrackState & first,
513 GXFTrackState & last,
514 const TrackParameters * refpar,
515 bool hasmat
516 ) ;
517
541 const EventContext& ctx,
542 Cache & cache,
543 GXFTrajectory & track,
544 const TrackParameters * parameters,
546 ) const;
547
548 void addMaterial(
549 const EventContext& ctx,
550 Cache &,
552 const TrackParameters *,
554 ) const;
555
570 std::vector<std::unique_ptr<TrackParameters>> holesearchExtrapolation(
571 const EventContext & ctx,
572 const TrackParameters & src,
573 const GXFTrackState & dst,
574 PropDirection propdir
575 ) const;
576
577 std::unique_ptr<const TrackParameters> makePerigee(
578 Cache &,
579 const TrackParameters &,
581 ) const;
582
584 Cache &,
586 ) ;
587
588 std::unique_ptr<const TrackParameters> makeTrackFindPerigeeParameters(
589 const EventContext &,
590 Cache &,
593 ) const;
594
595 std::unique_ptr<GXFTrackState> makeTrackFindPerigee(
596 const EventContext &,
597 Cache &,
600 ) const;
601
602 std::unique_ptr<Track> makeTrack(
603 const EventContext& ctx,
604 Cache &,
607 ) const;
608
609 /*
610 * @brief Fill the residual and error vector
611 *
612 * Loop over all track states and extract residual and error data. Then
613 * fill the data sorted into vectors. Since we have all data here, we
614 * already sum over all chi2 contributions. The b-vector is in this step
615 * only filled with the scattering contributions.
616 *
617 * @param[in] ctx An event context for extrapolation.
618 * @param[in] cache General cache object for asym energy loss.
619 * @param[in, out] trajectory The trajectory, we want to analyse.
620 * @param[in] it The current iteration, we are in.
621 * @param[in, out] b The b-vector to be filled with scattering elements.
622 * @param[in, out] bremno_maxbrempull The position of the maxbrempull in all brempull elements.
623 * @param[in, out] state_maxbrempull The actual state holding the maxbrempull.
624 */
626 const EventContext& ctx,
627 const Cache & cache,
628 GXFTrajectory & trajectory,
629 const int it,
630 Amg::VectorX & b,
631 int & bremno_maxbrempull,
632 GXFTrackState* & state_maxbrempull
633 ) const;
634
635 /*
636 * @brief Check if we already converged and set the flag.
637 *
638 * We run a few checks on convergence. Depending on the iteration we are in,
639 * different criteria are applied.
640 *
641 * @param[in] cache General cache object for the external iteration goal.
642 * @param[in, out] trajectory The trajectory, we want to analyse.
643 * @param[in] it The current iteration, we are in.
644 */
645 void tryToConverge(
646 const Cache & cache,
647 GXFTrajectory & trajectory,
648 const int it
649 ) const;
650
651 /*
652 * @brief Update errors with the information from the maxbremspull.
653 *
654 * Marks the state of the maxbremspull as a kink and updates the
655 * sigmaDeltaE. Then the error for the corresponding residual is updated.
656 * The [a]-matrix is modified with the new error information.
657 *
658 * @param[in, out] trajectory The trajectory, we want to analyse.
659 * @param[in] bremno_maxbrempull The position of the maxbrempull in the brempull list.
660 * @param[in, out] state_maxbrempull Pointer to the state, so we can modify it.
661 * @param[in, out] a The [a]-matrix of the system.
662 *
663 * @note You might want to redo your derivatives after this step.
664 */
666 GXFTrajectory & trajectory,
667 const int bremno_maxbrempull,
668 GXFTrackState* state_maxbrempull,
670 ) const;
671
672 void fillDerivatives(
673 GXFTrajectory & traj
674 ) const;
675
676 /*
677 * @brief Find and set first and last measurement for each fit parameter.
678 *
679 * Find the first and last measurement relevant for each parameter. The
680 * perigee parameter use all real measurements. For the scattering and
681 * brems parameters, all measurements after/before encountering that
682 * surface are skipped, depending if we are still looking at upstream
683 * states or not.
684 *
685 * @param[in, out] cache General cache object to fill with first/last.
686 * @param[in, out] trajectory The trajectory, we want to analyse.
687 */
688 static void fillFirstLastMeasurement(
689 Cache & cache,
690 GXFTrajectory & trajectory
691 ) ;
692
693 /*
694 * @brief Fill the b-vector with the residual information from the measurements.
695 *
696 * Loop over all fit parameters. For each, loop over all relevant,
697 * measurements and add the information to the b-vector. For each fit
698 * parameter k we get:
699 * b[k] = sum( res / error * derivative )
700 * For qOverP and brems we get also a contribution the brems elements in
701 * the b-vector.
702 *
703 * @param[out] cache General cache object for first/last measurements.
704 * @param[in, out] trajectory The trajectory, we want to analyse.
705 * @param[in, out] b The b-vector of the system.
706 */
707 static void fillBfromMeasurements(
708 const Cache & cache,
709 GXFTrajectory & trajectory,
710 Amg::VectorX & b
711 ) ;
712
713 /*
714 * @brief Fill the [a]-matrix with the derivative information from the measurements.
715 *
716 * Loop over all fit parameters in two dimensions k and l. For each, loop
717 * over all relevant, measurements and add the information to the
718 * [a]-matrix. We get:
719 * [a]_kl = sum( derivative_k * derivative_l )
720 *
721 * @param[out] cache General cache object for first/last measurements.
722 * @param[in, out] trajectory The trajectory, we want to analyse.
723 * @param[in, out] a The [a]-matrix of the system.
724 */
725 static void fillAfromMeasurements(
726 const Cache & cache,
727 GXFTrajectory & trajectory,
729 ) ;
730
731 /*
732 * @brief Fill the [a]-matrix with the derivative information from the scatterers.
733 *
734 * Loop over non-perigee (except qOverP) parameters in two dimensions k and
735 * l. For each, loop over all relevant, derivative entries and add the
736 * information to the [a]-matrix. We get an update of the diagonal:
737 * [a]_kk += 1 / scatSigma^2
738 * and an update of the general elements:
739 * [a]_kl += sum( derivative_k * derivative_l )
740 *
741 * @param[in, out] trajectory The trajectory, we want to analyse.
742 * @param[in, out] a The [a]-matrix of the system.
743 */
744 static void fillAfromScatterers(
745 GXFTrajectory & trajectory,
747 ) ;
748
749 /*
750 * @brief Update [a]-matrix with material effects by weighting some elements.
751 *
752 * Applies weights to the diagonal material elements in the [a]-matrix.
753 * The weights depend on the progress of the iteration and can vary on the
754 * absolute iteration number as well as on the convergence of the chi2.
755 *
756 * @param[in, out] cache General cache object for the phi weights.
757 * @param[in, out] trajectory The trajectory, we want to analyse.
758 * @param[in, out] a The [a]-matrix of the system.
759 * @param[in] doDeriv If we redid derivatives in this iteration
760 * @param[in] it The current iteration, we are in.
761 * @param[in] oldRedChi2 Old reduced chi2 for convergence analysis.
762 * @param[in] newdRedChi2 New reduced chi2 for convergence analysis.
763 *
764 * @return a bool if any weights have been applied.
765 *
766 * @note prefit == 1 does not do a lot, maybe changes weightChanged. Could be wrong behaviour?
767 */
768 static bool tryToWeightAfromMaterial(
769 Cache & cache,
770 GXFTrajectory & trajectory,
772 const bool doDeriv,
773 const int it,
774 const double oldRedChi2,
775 const double newRedChi2
776 ) ;
777
778 /*
779 * @brief Effectively removes the phi weights from the [a]-matrix.
780 *
781 * Removes the phi weights added by tryToWeightAfromMaterial() from the
782 * diagonal material elements in the [a]-matrix. Then sets the stored
783 * weights to 1.
784 *
785 * @param[in, out] cache General cache object for the phi weights.
786 * @param[in, out] trajectory The trajectory, we want to analyse.
787 * @param[in, out] a The [a]-matrix of the system.
788 */
789 static void compensatePhiWeights(
790 Cache & cache,
791 GXFTrajectory & trajectory,
793 ) ;
794
795 /*
796 * @brief Performs the main work of the GX2F iteration.
797 *
798 * The main parts are:
799 * - calculate parameters
800 * - calculate residuals
801 * - (opt) redo derivatives
802 * - fill b-vector
803 * - (opt) update [a]-matrix
804 * - (opt) update [lu]-matrix
805 * - check for convergence
806 *
807 * @param[in] ctx An event context for extrapolation.
808 * @param[in, out] cache General cache object for.
809 * @param[in, out] trajectory The trajectory, we want to analyse.
810 * @param[in] it The current iteration, we are in.
811 * @param[in, out] a The [a]-matrix of the system.
812 * @param[in, out] b The b-vector of the system.
813 * @param[in, out] lu The [lu]-matrix of the system.
814 * @param[in, out] doDeriv Toggle if we need to do now and return if we need to do again.
815 *
816 * @return a status code with success or a detailed error.
817 */
818
820 const EventContext& ctx,
821 Cache & cache,
822 GXFTrajectory & trajectory,
823 const int it,
825 Amg::VectorX & b,
826 Amg::SymMatrixX & lu,
827 bool & doDeriv
828 ) const;
829
838 const Amg::VectorX &,
839 const Amg::SymMatrixX &
840 ) const;
841
842
846 void updatePixelROTs(
849 Amg::VectorX &,
850 const EventContext& evtctx
851 ) const;
852
853
860 const EventContext& ctx,
861 Cache &,
865 Amg::VectorX &,
866 bool
867 ) const;
868
870 Cache &,
873 Amg::VectorX &,
875 bool, bool, int,
876 const EventContext& ctx
877 ) const;
878
892 const EventContext &,
893 const TrackParameters &,
894 const GXFTrackState &,
897 bool,
898 bool
899 ) const;
900
942 const EventContext &,
943 const TrackParameters &,
944 const GXFTrackState &,
947 bool,
948 bool
949 ) const;
950
978 std::vector<std::reference_wrapper<GXFTrackState>> holeSearchStates(
979 GXFTrajectory & trajectory
980 ) const;
981
1003 std::optional<GlobalChi2Fitter::TrackHoleCount> holeSearchProcess(
1004 const EventContext & ctx,
1005 const std::vector<std::reference_wrapper<GXFTrackState>> & states
1006 ) const;
1007
1030 void holeSearchHelper(
1031 const std::vector<std::unique_ptr<TrackParameters>> & hc,
1032 std::set<Identifier> & id_set,
1033 std::set<Identifier> & sct_set,
1034 TrackHoleCount & rv,
1035 bool count_holes,
1036 bool count_dead
1037 ) const;
1038
1040 const EventContext& ctx,
1042 bool) const;
1043
1044 std::variant<std::unique_ptr<const TrackParameters>, FitterStatusCode> updateEnergyLoss(
1045 const Surface &,
1046 const GXFMaterialEffects &,
1047 const TrackParameters &,
1048 double,
1049 int
1050 ) const;
1051
1052 static void calculateDerivatives(GXFTrajectory &) ;
1053
1054 void calculateTrackErrors(GXFTrajectory &, Amg::SymMatrixX &, bool) const;
1055
1056 std::optional<TransportJacobian> numericalDerivatives(
1057 const EventContext& ctx,
1058 const TrackParameters *,
1059 const Surface &,
1062 ) const;
1063
1064 virtual int iterationsOfLastFit() const;
1065
1066 virtual void setMinIterations(int);
1067
1068 static bool correctAngles(double &, double &) ;
1069
1070 bool isMuonTrack(const Track &) const;
1071
1083 void initFieldCache(
1084 const EventContext& ctx,
1085 Cache & cache
1086 ) const;
1087
1088 ToolHandle<IRIO_OnTrackCreator> m_ROTcreator {this, "RotCreatorTool", "", ""};
1089 ToolHandle<IRIO_OnTrackCreator> m_broadROTcreator {this, "BroadRotCreatorTool", "", ""};
1090 ToolHandle<IUpdator> m_updator {this, "MeasurementUpdateTool", "", ""};
1091 ToolHandle<IExtrapolator> m_extrapolator {this, "ExtrapolationTool", "Trk::Extrapolator/CosmicsExtrapolator", ""};
1092 ToolHandle<IMultipleScatteringUpdator> m_scattool {this, "MultipleScatteringTool", "Trk::MultipleScatteringUpdator/AtlasMultipleScatteringUpdator", ""};
1093 ToolHandle<IEnergyLossUpdator> m_elosstool {this, "EnergyLossTool", "Trk::EnergyLossUpdator/AtlasEnergyLossUpdator", ""};
1094 ToolHandle<IMaterialEffectsUpdator> m_matupdator {this, "MaterialUpdateTool", "", ""};
1095 ToolHandle<IPropagator> m_propagator {this, "PropagatorTool", "", ""};
1096 ToolHandle<INavigator> m_navigator {this, "NavigatorTool", "Trk::Navigator/CosmicsNavigator", ""};
1097 ToolHandle<IResidualPullCalculator> m_residualPullCalculator {this, "ResidualPullCalculatorTool", "Trk::ResidualPullCalculator/ResidualPullCalculator", ""};
1098 ToolHandle<Trk::ITrkMaterialProviderTool> m_caloMaterialProvider {this, "CaloMaterialProvider", "Trk::TrkMaterialProviderTool/TrkMaterialProviderTool", ""};
1099 ToolHandle<IMaterialEffectsOnTrackProvider> m_calotool {this, "MuidTool", "Rec::MuidMaterialEffectsOnTrackProvider/MuidMaterialEffectsOnTrackProvider", ""};
1100 ToolHandle<IMaterialEffectsOnTrackProvider> m_calotoolparam {this, "MuidToolParam", "", ""};
1101 ToolHandle<IBoundaryCheckTool> m_boundaryCheckTool {this, "BoundaryCheckTool", "", "Boundary checking tool for detector sensitivities" };
1102
1104
1105 /*
1106 * @brief Check if the entrance to the calo is valid. If not, attempt to fix it.
1107 *
1108 * Ensure that the cache contains a valid tracking geometry that we can
1109 * use. If it is not set yet, set it as InDet::Containers::InnerDetector.
1110 *
1111 * @param[in] ctx A context for creating the geometry.
1112 * @param[in, out] cache The GX2F cache objects.
1113 */
1115 const EventContext& ctx,
1116 Cache& cache
1117 ) const;
1118
1119 /*
1120 * @brief Check if the entrance to the Muon Spectrometer is valid. If not, attempt to fix it.
1121 *
1122 * Ensure that the cache contains a valid tracking geometry that we can
1123 * use. If it is not set yet, set it as MuonSpectrometerEntrance.
1124 *
1125 * @param[in] ctx A context for creating the geometry.
1126 * @param[in, out] cache The GX2F cache objects.
1127 */
1129 const EventContext& ctx,
1130 Cache& cache
1131 ) const;
1132
1134 const EventContext& ctx) const
1135 {
1136 if (!cache.m_trackingGeometry)
1137 cache.m_trackingGeometry = retrieveTrackingGeometry(ctx);
1138 return cache.m_trackingGeometry;
1139 }
1141 const EventContext& ctx) const
1142 {
1144 ctx);
1145 if (!handle.isValid()) {
1147 }
1148 return handle.cptr();
1149 }
1150
1152 this,
1153 "TrackingGeometryReadKey",
1154 "AtlasTrackingGeometry",
1155 "Key of the TrackingGeometry conditions data."
1156 };
1157
1159 this,
1160 "AtlasFieldCacheCondObj",
1161 "fieldCondObj",
1162 "Trk::GlobalChi2Fitter field conditions object key"
1163 };
1164
1165 const AtlasDetectorID *m_DetID = nullptr;
1166
1167 Gaudi::Property<bool> m_signedradius {this, "SignedDriftRadius", true};
1168 Gaudi::Property<bool> m_calomat {this, "MuidMat", false};
1169 Gaudi::Property<bool> m_extmat {this, "ExtrapolatorMaterial", true};
1170 Gaudi::Property<bool> m_fillderivmatrix {this, "FillDerivativeMatrix", false};
1171 Gaudi::Property<bool> m_straightlineprop {this, "StraightLine", true};
1172 Gaudi::Property<bool> m_extensioncuts {this, "TRTExtensionCuts", true};
1173 Gaudi::Property<bool> m_sirecal {this, "RecalibrateSilicon", false};
1174 Gaudi::Property<bool> m_trtrecal {this, "RecalibrateTRT", false};
1175 Gaudi::Property<bool> m_kinkfinding {this, "KinkFinding", false};
1176 Gaudi::Property<bool> m_decomposesegments {this, "DecomposeSegments", true};
1177 Gaudi::Property<bool> m_getmaterialfromtrack {this, "GetMaterialFromTrack", true};
1178 Gaudi::Property<bool> m_domeastrackpar {this, "MeasuredTrackParameters", true};
1179 Gaudi::Property<bool> m_storemat {this, "StoreMaterialOnTrack", true};
1180 Gaudi::Property<bool> m_redoderivs {this, "RecalculateDerivatives", false};
1181 Gaudi::Property<bool> m_reintoutl {this, "ReintegrateOutliers", false};
1182 Gaudi::Property<bool> m_acceleration {this, "Acceleration", false};
1183 Gaudi::Property<bool> m_numderiv {this, "NumericalDerivs", false};
1184 Gaudi::Property<bool> m_fiteloss {this, "FitEnergyLoss", false};
1185 Gaudi::Property<bool> m_asymeloss {this, "AsymmetricEnergyLoss", true};
1186 Gaudi::Property<bool> m_useCaloTG {this, "UseCaloTG", false};
1187 Gaudi::Property<bool> m_rejectLargeNScat {this, "RejectLargeNScat", false};
1188 Gaudi::Property<bool> m_createSummary {this, "CreateTrackSummary", true};
1189 Gaudi::Property<bool> m_holeSearch {this, "DoHoleSearch", false};
1190
1191 Gaudi::Property<double> m_outlcut {this, "OutlierCut", 5.0};
1192 Gaudi::Property<double> m_p {this, "Momentum", 0.0};
1193 Gaudi::Property<double> m_chi2cut {this, "TrackChi2PerNDFCut", 1.e15};
1194 Gaudi::Property<double> m_scalefactor {this, "TRTTubeHitCut", 2.5};
1195 Gaudi::Property<double> m_minphfcut {this, "MinPHFCut", 0.};
1196
1197 Gaudi::Property<int> m_maxoutliers {this, "MaxOutliers", 10};
1198 Gaudi::Property<int> m_maxit {this, "MaxIterations", 30};
1199 Gaudi::Property<int> m_miniter {this, "MinimumIterations", 1};
1200 Gaudi::Property<int> m_fixbrem {this, "FixBrem", -1};
1201 Gaudi::Property<int> m_maxitPixelROT {this, "IterationsToRebuildPixelRots", 0};
1202
1204
1205
1206 /*
1207 * This little volume defines the inner detector. Its exact size is set at
1208 * the time that the fitter object is created. We just make one and keep
1209 * it around to save us a few allocations.
1210 */
1212
1213 /*
1214 * The following members are mutable. They keep track of the number of
1215 * fits that have returned with a certain status. Since this must be
1216 * shared across threads, we protect the array with a mutex, and we mark
1217 * these members as thread_safe for the ATLAS G++ plugin.
1218 */
1219 //mutable std::mutex m_fit_status_lock ATLAS_THREAD_SAFE;
1220 mutable std::array<std::atomic<unsigned int>, S_MAX_VALUE> m_fit_status ATLAS_THREAD_SAFE = {};
1221 };
1222}
1223#endif
static Double_t a
This class provides an interface to generate or decode an identifier for the upper levels of the dete...
Local cache for magnetic field (based on MagFieldServices/AtlasFieldSvcTLS.h).
Property holding a SG store/key/clid from which a ReadHandle is made.
Class to describe a cylindrical detector layer for tracking, it inhertis from both,...
Class for a CylinderSurface in the ATLAS detector.
Class to describe a disc-like detector layer for tracking, it inhertis from both, Layer base class an...
Definition DiscLayer.h:45
Class for a DiscSurface in the ATLAS detector.
Definition DiscSurface.h:54
Status codes for track fitters.
class that is similar to MaterialEffectsOnTrack, but has 'set' methods for more flexibility during tr...
Internal representation of the track, used in the track fit.
Gaudi::Property< int > m_maxoutliers
ToolHandle< IBoundaryCheckTool > m_boundaryCheckTool
Gaudi::Property< bool > m_reintoutl
std::unique_ptr< Track > makeTrack(const EventContext &ctx, Cache &, GXFTrajectory &, const ParticleHypothesis) const
void tryToConverge(const Cache &cache, GXFTrajectory &trajectory, const int it) const
void makeProtoState(Cache &, GXFTrajectory &, const TrackStateOnSurface *, int index=-1) const
Gaudi::Property< double > m_p
FitterStatusCode calculateTrackParameters(const EventContext &ctx, GXFTrajectory &, bool) const
Track * myfit(const EventContext &ctx, Cache &, GXFTrajectory &, const TrackParameters &, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=nonInteracting) const
Gaudi::Property< bool > m_signedradius
void fillResidualsAndErrors(const EventContext &ctx, const Cache &cache, GXFTrajectory &trajectory, const int it, Amg::VectorX &b, int &bremno_maxbrempull, GXFTrackState *&state_maxbrempull) const
Gaudi::Property< double > m_scalefactor
Gaudi::Property< bool > m_rejectLargeNScat
std::variant< std::unique_ptr< const TrackParameters >, FitterStatusCode > updateEnergyLoss(const Surface &, const GXFMaterialEffects &, const TrackParameters &, double, int) const
ToolHandle< Trk::ITrkMaterialProviderTool > m_caloMaterialProvider
Gaudi::Property< bool > m_trtrecal
bool processTrkVolume(Cache &, const Trk::TrackingVolume *tvol) const
ToolHandle< IPropagator > m_propagator
Gaudi::Property< bool > m_straightlineprop
Gaudi::Property< bool > m_fiteloss
std::optional< GlobalChi2Fitter::TrackHoleCount > holeSearchProcess(const EventContext &ctx, const std::vector< std::reference_wrapper< GXFTrackState > > &states) const
Conduct a hole search between a list of states, possibly reusing existing information.
static std::optional< std::pair< Amg::Vector3D, double > > addMaterialFindIntersectionDisc(Cache &cache, const DiscSurface &surface, const TrackParameters &param1, const TrackParameters &param2, const ParticleHypothesis mat)
Find the intersection of a set of track parameters onto a disc surface.
ToolHandle< INavigator > m_navigator
Gaudi::Property< bool > m_sirecal
void updateSystemWithMaxBremPull(GXFTrajectory &trajectory, const int bremno_maxbrempull, GXFTrackState *state_maxbrempull, Amg::SymMatrixX &a) const
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainer
Gaudi::Property< bool > m_extmat
ToolHandle< IRIO_OnTrackCreator > m_broadROTcreator
std::unique_ptr< GXFTrackState > makeTrackFindPerigee(const EventContext &, Cache &, GXFTrajectory &, const ParticleHypothesis) const
Gaudi::Property< bool > m_asymeloss
FitterStatusCode updateFitParameters(GXFTrajectory &, const Amg::VectorX &, const Amg::SymMatrixX &) const
Method to update peregee parameters, scattering angles, and brems.
void addMaterial(const EventContext &ctx, Cache &, GXFTrajectory &, const TrackParameters *, ParticleHypothesis) const
static void fillFirstLastMeasurement(Cache &cache, GXFTrajectory &trajectory)
Gaudi::Property< bool > m_storemat
PropagationResult calculateTrackParametersPropagateHelper(const EventContext &, const TrackParameters &, const GXFTrackState &, PropDirection, const MagneticFieldProperties &, bool, bool) const
Helper method that encapsulates calls to the propagator tool in the calculateTrackParameters() method...
ToolHandle< IUpdator > m_updator
std::array< std::atomic< unsigned int >, S_MAX_VALUE > m_fit_status ATLAS_THREAD_SAFE
const TrackingGeometry * retrieveTrackingGeometry(const EventContext &ctx) const
static void fillBfromMeasurements(const Cache &cache, GXFTrajectory &trajectory, Amg::VectorX &b)
std::unique_ptr< const TrackParameters > makeTrackFindPerigeeParameters(const EventContext &, Cache &, GXFTrajectory &, const ParticleHypothesis) const
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_field_cache_key
Gaudi::Property< bool > m_domeastrackpar
virtual int iterationsOfLastFit() const
Gaudi::Property< int > m_fixbrem
Track * backupCombinationStrategy(const EventContext &ctx, Cache &, const Track &, const Track &, GXFTrajectory &, std::vector< MaterialEffectsOnTrack > &) const
GlobalChi2Fitter(const std::string &, const std::string &, const IInterface *)
Track * mainCombinationStrategy(const EventContext &ctx, Cache &, const Track &, const Track &, GXFTrajectory &, std::vector< MaterialEffectsOnTrack > &) const
static void compensatePhiWeights(Cache &cache, GXFTrajectory &trajectory, Amg::SymMatrixX &a)
const TrackingGeometry * trackingGeometry(Cache &cache, const EventContext &ctx) const
Gaudi::Property< int > m_maxit
PropagationResult calculateTrackParametersPropagate(const EventContext &, const TrackParameters &, const GXFTrackState &, PropDirection, const MagneticFieldProperties &, bool, bool) const
Propagate onto a track state, collecting new track parameters, and optionally the Jacobian and possib...
ToolHandle< IExtrapolator > m_extrapolator
void makeProtoStateFromMeasurement(Cache &, GXFTrajectory &, const MeasurementBase *, const TrackParameters *trackpar=nullptr, bool isoutlier=false, int index=-1) const
std::optional< TransportJacobian > numericalDerivatives(const EventContext &ctx, const TrackParameters *, const Surface &, PropDirection, const MagneticFieldProperties &) const
void addIDMaterialFast(const EventContext &ctx, Cache &cache, GXFTrajectory &track, const TrackParameters *parameters, ParticleHypothesis part) const
A faster strategy for adding scatter material to tracks, works only for inner detector tracks.
static void fillAfromScatterers(GXFTrajectory &trajectory, Amg::SymMatrixX &a)
void updatePixelROTs(GXFTrajectory &, Amg::SymMatrixX &, Amg::VectorX &, const EventContext &evtctx) const
Update the Pixel ROT using the current trajectory/local track parameters.
Gaudi::Property< double > m_outlcut
Gaudi::Property< bool > m_calomat
Gaudi::Property< bool > m_fillderivmatrix
ToolHandle< IMaterialEffectsOnTrackProvider > m_calotoolparam
ToolHandle< IRIO_OnTrackCreator > m_ROTcreator
GXFTrajectory * runTrackCleanerSilicon(const EventContext &ctx, Cache &, GXFTrajectory &, Amg::SymMatrixX &, Amg::SymMatrixX &, Amg::VectorX &, bool) const
std::unique_ptr< const TrackParameters > makePerigee(Cache &, const TrackParameters &, const ParticleHypothesis) const
virtual std::unique_ptr< Track > fit(const EventContext &ctx, const PrepRawDataSet &, const TrackParameters &, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=nonInteracting) const override final
Gaudi::Property< double > m_chi2cut
void throwFailedToGetTrackingGeomtry() const
virtual Track * alignmentFit(const EventContext &ctx, AlignmentCache &, const Track &, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=Trk::nonInteracting) const override
Gaudi::Property< bool > m_extensioncuts
virtual void setMinIterations(int)
bool ensureValidEntranceCalo(const EventContext &ctx, Cache &cache) const
static void addMaterialGetLayers(Cache &cache, std::vector< std::pair< const Layer *, const Layer * > > &layers, std::vector< std::pair< const Layer *, const Layer * > > &uplayers, const std::vector< std::unique_ptr< GXFTrackState > > &states, GXFTrackState &first, GXFTrackState &last, const TrackParameters *refpar, bool hasmat)
Collect all possible layers that a given track could have passed through.
static std::optional< std::pair< Amg::Vector3D, double > > addMaterialFindIntersectionCyl(Cache &cache, const CylinderSurface &surface, const TrackParameters &param1, const TrackParameters &param2, const ParticleHypothesis mat)
Find the intersection of a set of track parameters onto a cylindrical surface.
void runTrackCleanerTRT(Cache &, GXFTrajectory &, Amg::SymMatrixX &, Amg::VectorX &, Amg::SymMatrixX &, bool, bool, int, const EventContext &ctx) const
static void calculateDerivatives(GXFTrajectory &)
Gaudi::Property< bool > m_decomposesegments
void calculateTrackErrors(GXFTrajectory &, Amg::SymMatrixX &, bool) const
static bool correctAngles(double &, double &)
bool ensureValidEntranceMuonSpectrometer(const EventContext &ctx, Cache &cache) const
bool isMuonTrack(const Track &) const
std::vector< std::unique_ptr< TrackParameters > > holesearchExtrapolation(const EventContext &ctx, const TrackParameters &src, const GXFTrackState &dst, PropDirection propdir) const
Helper method which performs an extrapolation with additional logic for hole search.
virtual StatusCode finalize() override
Gaudi::Property< bool > m_useCaloTG
std::vector< std::reference_wrapper< GXFTrackState > > holeSearchStates(GXFTrajectory &trajectory) const
Extracts a collection of track states which are important for hole search.
Track * fitIm(const EventContext &ctx, Cache &cache, const Track &inputTrack, const RunOutlierRemoval runOutlier, const ParticleHypothesis matEffects) const
Gaudi::Property< bool > m_redoderivs
void initFieldCache(const EventContext &ctx, Cache &cache) const
Initialize a field cache inside a fit cache object.
Gaudi::Property< int > m_maxitPixelROT
ToolHandle< IMaterialEffectsOnTrackProvider > m_calotool
ToolHandle< IMaterialEffectsUpdator > m_matupdator
void holeSearchHelper(const std::vector< std::unique_ptr< TrackParameters > > &hc, std::set< Identifier > &id_set, std::set< Identifier > &sct_set, TrackHoleCount &rv, bool count_holes, bool count_dead) const
Helper method for the hole search that does the actual counting of holes and dead modules.
ToolHandle< IResidualPullCalculator > m_residualPullCalculator
void addMaterialUpdateTrajectory(Cache &cache, GXFTrajectory &track, int offset, std::vector< std::pair< const Layer *, const Layer * > > &layers, const TrackParameters *ref1, const TrackParameters *ref2, ParticleHypothesis mat) const
Given layer information, probe those layers for scatterers and add them to a track.
ToolHandle< IEnergyLossUpdator > m_elosstool
void fillDerivatives(GXFTrajectory &traj) const
Gaudi::Property< bool > m_numderiv
SG::ReadCondHandleKey< TrackingGeometry > m_trackingGeometryReadKey
Gaudi::Property< bool > m_kinkfinding
Gaudi::Property< bool > m_acceleration
static bool tryToWeightAfromMaterial(Cache &cache, GXFTrajectory &trajectory, Amg::SymMatrixX &a, const bool doDeriv, const int it, const double oldRedChi2, const double newRedChi2)
const AtlasDetectorID * m_DetID
static void fillAfromMeasurements(const Cache &cache, GXFTrajectory &trajectory, Amg::SymMatrixX &a)
virtual StatusCode initialize() override
static void makeTrackFillDerivativeMatrix(Cache &, GXFTrajectory &)
Gaudi::Property< bool > m_holeSearch
FitterStatusCode runIteration(const EventContext &ctx, Cache &cache, GXFTrajectory &trajectory, const int it, Amg::SymMatrixX &a, Amg::VectorX &b, Amg::SymMatrixX &lu, bool &doDeriv) const
Gaudi::Property< bool > m_createSummary
Track * myfit_helper(Cache &, GXFTrajectory &, const TrackParameters &, const RunOutlierRemoval runOutlier=false, const ParticleHypothesis matEffects=nonInteracting) const
Gaudi::Property< int > m_miniter
ToolHandle< IMultipleScatteringUpdator > m_scattool
Gaudi::Property< double > m_minphfcut
Gaudi::Property< bool > m_getmaterialfromtrack
Base Class for a Detector Layer in the Tracking realm.
Definition Layer.h:72
magnetic field properties to steer the behavior of the extrapolation
represents the full description of deflection and e-loss of a track in material.
Class implementing a comparison function for sorting MeasurementBase objects.
This class is the pure abstract base class for all fittable tracking measurements.
Class providing comparison function, or relational definition, for PrepRawData.
Abstract Base Class for tracking surfaces.
Definition Surface.h:79
represents the track state (measurement, material, fit parameters and quality) at a surface.
The TrackingGeometry class is the owner of the constructed TrackingVolumes.
Full Volume description used in Tracking, it inherits from Volume to get the geometrical structure,...
Base class for all volumes inside the tracking realm, it defines the interface for inherited Volume c...
Definition Volume.h:36
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > MatrixX
Dynamic Matrix - dynamic allocation.
Eigen::Matrix< double, Eigen::Dynamic, Eigen::Dynamic > SymMatrixX
Eigen::Matrix< double, Eigen::Dynamic, 1 > VectorX
Dynamic Vector - dynamic allocation.
Ensure that the ATLAS eigen extensions are properly loaded.
PropDirection
PropDirection, enum for direction of the propagation.
std::vector< const MeasurementBase * > MeasurementSet
vector of fittable measurements
Definition FitterTypes.h:30
Perigee MeasuredPerigee
bool RunOutlierRemoval
switch to toggle quality processing after fit
Definition FitterTypes.h:22
ParticleHypothesis
Enumeration for Particle hypothesis respecting the interaction with material.
ParametersBase< TrackParametersDim, Charged > TrackParameters
const IIntersectionCache * cache() const
Retrieve the associated cache block, if it exists.
std::vector< const PrepRawData * > PrepRawDataSet
vector of clusters and drift circles
Definition FitterTypes.h:26
Definition index.py:1
std::vector< std::unique_ptr< const std::vector< const TrackStateOnSurface * >, void(*)(const std::vector< const TrackStateOnSurface * > *) > > m_matTempStore
void incrementFitStatus(enum FitterStatusType status)
std::vector< const Trk::Layer * > m_posdiscs
std::vector< int > m_lastmeasurement
std::vector< const Trk::Layer * > m_negdiscs
std::vector< const Trk::Layer * > m_barrelcylinders
MagField::AtlasFieldCache m_field_cache
static void objVectorDeleter(const std::vector< const T * > *ptr)
std::vector< int > m_firstmeasurement
std::array< std::atomic< unsigned int >, S_MAX_VALUE > * m_fit_status_out
std::array< unsigned int, S_MAX_VALUE > m_fit_status
std::vector< double > m_phiweight
const TrackingVolume * m_msEntrance
const TrackingGeometry * m_trackingGeometry
Cache(const GlobalChi2Fitter *fitter)
const TrackingVolume * m_caloEntrance
Cache & operator=(const Cache &)=delete
std::optional< TransportJacobian > m_jacobian
std::optional< std::vector< std::unique_ptr< TrackParameters > > > m_preholes
std::unique_ptr< const TrackParameters > m_parameters