6 #include <Acts/Utilities/Enumerate.hpp>
9 using namespace SegmentFit;
14 m_cfg{std::move(
cfg)} {}
22 std::ranges::stable_sort(toResolve,[
this](
const SegmentVec::value_type&
a,
23 const SegmentVec::value_type&
b){
27 return a->nDoF() >
b->nDoF();
29 return redChi2A < redChi2B;
34 resolved.push_back(std::move(toResolve[0]));
35 toResolve.erase(toResolve.begin());
36 std::vector<std::vector<int>> segmentSigns{
driftSigns(gctx, *resolved.front(), resolved.front()->measurements())};
37 std::vector<MeasurementSet> segMeasurements{
extractPrds(*resolved.front())};
39 for (std::unique_ptr<Segment>& resolveMe : toResolve) {
41 <<
" redChi2: "<<
redChi2(*resolveMe)<<
" nDoF: "<<resolveMe->nDoF());
45 unsigned int resolvedIdx{0};
46 for (std::unique_ptr<Segment>& goodSeg : resolved) {
48 <<
" redChi2: "<<
redChi2(*goodSeg)<<
" nDoF: "<<goodSeg->nDoF());
50 std::vector<int>& existSigns{segmentSigns[resolvedIdx++]};
52 unsigned int shared =
countShared(resolvedM, testMeas);
58 const std::vector<int> reEvaluatedSigns{
driftSigns(gctx, *resolveMe, goodSeg->measurements())};
60 unsigned int sameSides{0};
61 for (
unsigned int s =0 ;
s < existSigns.size(); ++
s) {
62 sameSides += (reEvaluatedSigns[
s] == existSigns[
s]);
65 if (!
m_cfg.
remLeftRightAmbi && sameSides != existSigns.size() && resolveMe->nDoF() == goodSeg->nDoF()) {
66 ATH_MSG_VERBOSE(
"Reference signs: "<<existSigns<<
" / re-evaluated: "<<reEvaluatedSigns);
69 const double resolvedChi2 =
redChi2(*goodSeg);
70 const double resolveMeChi2 =
redChi2(*resolveMe);
73 ATH_MSG_VERBOSE(
"Chi2 good "<<resolvedChi2<<
", candidate chi2: "<<resolveMeChi2);
82 existSigns =
driftSigns(gctx, *resolveMe, resolveMe->measurements());
89 segMeasurements.push_back(std::move(testMeas));
90 segmentSigns.push_back(
driftSigns(gctx, *resolveMe, resolveMe->measurements()));
91 resolved.push_back(std::move(resolveMe));
108 for (
const Segment::MeasVec::value_type& hit :
segment.measurements()) {
112 meas.insert(hit->spacePoint()->primaryMeasurement());
113 if (hit->spacePoint()->secondaryMeasurement()) {
114 meas.insert(hit->spacePoint()->secondaryMeasurement());
121 if (measSet1.size() > measSet2.size()) {
123 return measSet1.count(meas);
127 return measSet2.count(meas);