Skip to content

Commit 9a2b8ee

Browse files
committed
Common: DCAFitter catch maxIter reached
Signed-off-by: Felix Schlepper <felix.schlepper@cern.ch>
1 parent 2a86f4e commit 9a2b8ee

File tree

1 file changed

+25
-19
lines changed

1 file changed

+25
-19
lines changed

Common/DCAFitter/include/DCAFitter/DCAFitterN.h

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -125,19 +125,24 @@ class DCAFitterN
125125
};
126126

127127
enum FitStatus : uint8_t { // fit status of crossing hypothesis
128-
None = 0, // no status set
129-
Converged = 1, // fit converged
130-
NoCrossing = 2, // no reasaonable crossing was found
131-
RejRadius = 3, // radius of crossing was not acceptable
132-
RejTrackX = 4, // one candidate track x was below the mimimum required radius
133-
RejTrackRoughZ = 5, // rejected by rough cut on tracks Z difference
134-
RejChi2Max = 6, // rejected by maximum chi2 cut
135-
FailProp = 7, // propagation of at least prong to PCA failed
136-
FailInvCov = 8, // inversion of cov.-matrix failed
137-
FailInvWeight = 9, // inversion of Ti weight matrix failed
138-
FailInv2ndDeriv = 10, // inversion of 2nd derivatives failed
139-
FailCorrTracks = 11, // correction of tracks to updated x failed
140-
FailCloserAlt = 12, // alternative PCA is closer
128+
None, // no status set (should not be possible!)
129+
130+
/* Good Conditions */
131+
Converged, // fit converged
132+
MaxIter, // max iterations reached before fit convergence
133+
134+
/* Error Conditions */
135+
NoCrossing, // no reasaonable crossing was found
136+
RejRadius, // radius of crossing was not acceptable
137+
RejTrackX, // one candidate track x was below the mimimum required radius
138+
RejTrackRoughZ, // rejected by rough cut on tracks Z difference
139+
RejChi2Max, // rejected by maximum chi2 cut
140+
FailProp, // propagation of at least prong to PCA failed
141+
FailInvCov, // inversion of cov.-matrix failed
142+
FailInvWeight, // inversion of Ti weight matrix failed
143+
FailInv2ndDeriv, // inversion of 2nd derivatives failed
144+
FailCorrTracks, // correction of tracks to updated x failed
145+
FailCloserAlt, // alternative PCA is closer
141146
};
142147

143148
static constexpr int getNProngs() { return N; }
@@ -334,6 +339,10 @@ class DCAFitterN
334339
mCurHyp = 0;
335340
mAllowAltPreference = true;
336341
mOrder.fill(0);
342+
mPropFailed.fill(false);
343+
mTrPropDone.fill(false);
344+
mNIters.fill(0);
345+
mChi2.fill(-1);
337346
mFitStatus.fill(FitStatus::None);
338347
}
339348

@@ -431,9 +440,6 @@ GPUd() int DCAFitterN<N, Args...>::process(const Tr&... args)
431440
mFitStatus[mCurHyp] = FitStatus::NoCrossing;
432441
return 0;
433442
}
434-
for (int ih = 0; ih < MAXHYP; ih++) {
435-
mPropFailed[ih] = false;
436-
}
437443
if (mUseAbsDCA) {
438444
calcRMatrices(); // needed for fast residuals derivatives calculation in case of abs. distance minimization
439445
}
@@ -455,9 +461,6 @@ GPUd() int DCAFitterN<N, Args...>::process(const Tr&... args)
455461
}
456462
mCrossIDCur = ic;
457463
mCrossIDAlt = (mCrossings.nDCA == 2 && mAllowAltPreference) ? 1 - ic : -1; // works for max 2 crossings
458-
mNIters[mCurHyp] = 0;
459-
mTrPropDone[mCurHyp] = false;
460-
mChi2[mCurHyp] = -1.;
461464
mPCA[mCurHyp][0] = mCrossings.xDCA[ic];
462465
mPCA[mCurHyp][1] = mCrossings.yDCA[ic];
463466

@@ -1102,6 +1105,9 @@ GPUd() bool DCAFitterN<N, Args...>::minimizeChi2NoErr()
11021105
}
11031106
chi2 = chi2Upd;
11041107
} while (++mNIters[mCurHyp] < mMaxIter);
1108+
if (mNIters[mCurHyp] == mMaxIter) {
1109+
mFitStatus[mCurHyp] = FitStatus::MaxIter;
1110+
}
11051111
//
11061112
mChi2[mCurHyp] = chi2 * NInv;
11071113
if (mChi2[mCurHyp] >= mMaxChi2) {

0 commit comments

Comments
 (0)