Skip to content

Commit 300884c

Browse files
authored
Merge pull request #48970 from leonardogiannini/from-CMSSW_15_1_0_pre6
[mkFit] propagation to plane in backward fit phase2 and bug fix
2 parents 96ce323 + 48a8598 commit 300884c

File tree

7 files changed

+286
-40
lines changed

7 files changed

+286
-40
lines changed

RecoTracker/MkFitCMS/interface/LayerNumberConverter.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,16 @@ namespace mkfit {
2525
bool isPhase2() const { return lo_ == TkLayout::phase2; }
2626
int convertLayerNumber(int det, int lay, bool useMatched, int isStereo, bool posZ) const {
2727
if (lo_ == TkLayout::phase2) {
28+
// For TOB / TEC stereo is used for P in PS modules so we move stereo before the other
29+
// one. The same is done for 2S layers (well, TEC is mixed PS / 2S anyway).
2830
if (det == 1)
2931
return lay - 1;
3032
if (det == 2)
3133
return 16 + lay - 1 + (posZ ? 0 : 22);
3234
if (det == 5)
33-
return 4 + (2 * (lay - 1)) + isStereo;
35+
return 4 + (2 * (lay - 1)) + 1 - isStereo;
3436
if (det == 4)
35-
return 16 + 12 + (2 * (lay - 1)) + isStereo + (posZ ? 0 : 22);
37+
return 16 + 12 + (2 * (lay - 1)) + 1 - isStereo + (posZ ? 0 : 22);
3638
throw std::runtime_error("bad subDet");
3739
}
3840

RecoTracker/MkFitCore/interface/Config.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ namespace mkfit {
4949
// Config for propagation - could/should enter into PropagationFlags?!
5050
constexpr int Niter = 5;
5151
constexpr bool useTrigApprox = true;
52+
// for prop to plane getS step
53+
constexpr int nSStepsInProp2Plane = 2;
5254
// Move to Config.cc, make a command-line option in mkFit.cc to ease profiling comparisons.
5355
// If making this constexpr again, also fix ifs using it in MkBuilder.cc and MkFinder.cc.
5456
// constexpr bool usePropToPlane = true;

RecoTracker/MkFitCore/src/KalmanUtilsMPlex.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ namespace mkfit {
1010

1111
enum KalmanFilterOperation { KFO_Calculate_Chi2 = 1, KFO_Update_Params = 2, KFO_Local_Cov = 4 };
1212

13+
inline void kalmanCheckChargeFlip(MPlexLV& outPar, MPlexQI& Chg, int N_proc) {
14+
for (int n = 0; n < NN; ++n) {
15+
if (n < N_proc && outPar.At(n, 3, 0) < 0) {
16+
Chg.At(n, 0, 0) = -Chg.At(n, 0, 0);
17+
outPar.At(n, 3, 0) = -outPar.At(n, 3, 0);
18+
}
19+
}
20+
}
21+
1322
//------------------------------------------------------------------------------
1423

1524
void kalmanUpdate(const MPlexLS& psErr,

RecoTracker/MkFitCore/src/MkBuilder.cc

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1381,19 +1381,32 @@ namespace mkfit {
13811381
}
13821382
#endif
13831383

1384-
// input tracks
1385-
mkfndr->bkFitInputTracks(eoccs, icand, end);
1386-
1387-
// fit tracks back to first layer
1388-
mkfndr->bkFitFitTracks(m_job->m_event_of_hits, st_par, end - icand, chi_debug);
1384+
if (Config::usePropToPlane) {
1385+
// input tracks
1386+
mkfndr->bkFitInputTracks(eoccs, icand, end);
1387+
// fit tracks back to first layer
1388+
mkfndr->bkFitFitTracksProp2Plane(m_job->m_event_of_hits, st_par, end - icand, chi_debug);
1389+
// tracks are put back into correcponding TrackCand when finsihed in the above function
1390+
// now move one last time to PCA
1391+
if (prop_config.backward_fit_to_pca) {
1392+
mkfndr->bkFitInputTracks(eoccs, icand, end);
1393+
mkfndr->bkFitPropTracksToPCA(end - icand);
1394+
mkfndr->bkFitOutputTracks(eoccs, icand, end, prop_config.backward_fit_to_pca);
1395+
}
1396+
} else {
1397+
// input tracks
1398+
mkfndr->bkFitInputTracks(eoccs, icand, end);
1399+
// fit tracks back to first layer
1400+
mkfndr->bkFitFitTracks(m_job->m_event_of_hits, st_par, end - icand, chi_debug);
1401+
1402+
// now move one last time to PCA
1403+
if (prop_config.backward_fit_to_pca) {
1404+
mkfndr->bkFitPropTracksToPCA(end - icand);
1405+
}
13891406

1390-
// now move one last time to PCA
1391-
if (prop_config.backward_fit_to_pca) {
1392-
mkfndr->bkFitPropTracksToPCA(end - icand);
1407+
mkfndr->bkFitOutputTracks(eoccs, icand, end, prop_config.backward_fit_to_pca);
13931408
}
13941409

1395-
mkfndr->bkFitOutputTracks(eoccs, icand, end, prop_config.backward_fit_to_pca);
1396-
13971410
#ifdef DEBUG_FINAL_FIT
13981411
dprintf("Post Final fit for %d - %d\n", icand, end);
13991412
for (int i = icand; i < end; ++i) {

0 commit comments

Comments
 (0)