4040#include < Framework/DataTypes.h>
4141#include < Framework/InitContext.h>
4242#include < Framework/runDataProcessing.h>
43- #include < GlobalTracking/MatchGlobalFwd.h>
44- #include " MCHGeometryTransformer/Transformations.h"
45- #include " MCHTracking/Track.h"
46- #include " MCHTracking/TrackParam.h"
47- #include " MCHTracking/TrackFitter.h"
48- #include " MCHBase/TrackerParam.h"
43+ #include < MCHGeometryTransformer/Transformations.h>
44+ #include < MCHTracking/Track.h>
45+ #include < MCHTracking/TrackParam.h>
46+ #include < MCHTracking/TrackFitter.h>
47+ #include < MCHBase/TrackerParam.h>
4948#include < MCHTracking/TrackExtrap.h>
5049#include < MFTTracking/Constants.h>
5150#include < ReconstructionDataFormats/TrackFwd.h>
@@ -169,10 +168,14 @@ struct GlobalMuonMatching {
169168 struct : ConfigurableGroup {
170169 Configurable<bool > cfgEnableMftAlignmentCorrections{" cfgEnableMFTAlignmentCorrections" , true , " Enable alignment corrections for the MFT tracks" };
171170 // slope corrections
172- Configurable<float > cfgMFTAlignmentCorrXSlopeTop{" cfgMFTAlignmentCorrXSlopeTop" , (-0.0006696 - 0.0005621 ) / 2 .f , " MFT X slope correction - top half" };
173- Configurable<float > cfgMFTAlignmentCorrXSlopeBottom{" cfgMFTAlignmentCorrXSlopeBottom" , (0.00105 + 0.001007 ) / 2 .f , " MFT X slope correction - bottom half" };
174- Configurable<float > cfgMFTAlignmentCorrYSlopeTop{" cfgMFTAlignmentCorrYSlopeTop" , (-0.002299 - 0.002442 ) / 2 .f , " MFT Y slope correction - top half" };
175- Configurable<float > cfgMFTAlignmentCorrYSlopeBottom{" cfgMFTAlignmentCorrYSlopeBottom" , (-0.0005339 - 0.0006921 ) / 2 .f , " MFT Y slope correction - bottom half" };
171+ // Configurable<float> cfgMFTAlignmentCorrXSlopeTop{"cfgMFTAlignmentCorrXSlopeTop", (-0.0006696 - 0.0005621) / 2.f, "MFT X slope correction - top half"};
172+ // Configurable<float> cfgMFTAlignmentCorrXSlopeBottom{"cfgMFTAlignmentCorrXSlopeBottom", (0.00105 + 0.001007) / 2.f, "MFT X slope correction - bottom half"};
173+ // Configurable<float> cfgMFTAlignmentCorrYSlopeTop{"cfgMFTAlignmentCorrYSlopeTop", (-0.002299 - 0.002442) / 2.f, "MFT Y slope correction - top half"};
174+ // Configurable<float> cfgMFTAlignmentCorrYSlopeBottom{"cfgMFTAlignmentCorrYSlopeBottom", (-0.0005339 - 0.0006921) / 2.f, "MFT Y slope correction - bottom half"};
175+ Configurable<float > cfgMFTAlignmentCorrXSlopeTop{" cfgMFTAlignmentCorrXSlopeTop" , 0 .f , " MFT X slope correction - top half" };
176+ Configurable<float > cfgMFTAlignmentCorrXSlopeBottom{" cfgMFTAlignmentCorrXSlopeBottom" , 0 .f , " MFT X slope correction - bottom half" };
177+ Configurable<float > cfgMFTAlignmentCorrYSlopeTop{" cfgMFTAlignmentCorrYSlopeTop" , 0 .f , " MFT Y slope correction - top half" };
178+ Configurable<float > cfgMFTAlignmentCorrYSlopeBottom{" cfgMFTAlignmentCorrYSlopeBottom" , 0 .f , " MFT Y slope correction - bottom half" };
176179 // offset corrections
177180 Configurable<float > cfgMFTAlignmentCorrXOffsetTop{" cfgMFTAlignmentCorrXOffsetTop" , 0 .f , " MFT X offset correction - top half" };
178181 Configurable<float > cfgMFTAlignmentCorrXOffsetBottom{" cfgMFTAlignmentCorrXOffsetBottom" , 0 .f , " MFT X offset correction - bottom half" };
@@ -1084,6 +1087,8 @@ struct GlobalMuonMatching {
10841087 TMFT const & mftTracks,
10851088 MyMFTCovariances const & mftCovs)
10861089 {
1090+ mMftTrackPars .clear ();
1091+ mMchTrackPars .clear ();
10871092 mMatchingCandidates .clear ();
10881093
10891094 LOGF (info, " Filling matching candidate tables" );
@@ -1095,8 +1100,7 @@ struct GlobalMuonMatching {
10951100 auto mchTrackIndex = muonTrack.globalIndex ();
10961101
10971102 // initialize the MCH track parameters, which will be updated by the realignment if enabled
1098- auto trackParIt = mMchTrackPars .find (mchTrackIndex);
1099- if (mMchTrackPars .find (mchTrackIndex) == mMchTrackPars .end ()) {
1103+ if (mMchTrackPars .count (mchTrackIndex) == 0 ) {
11001104 mMchTrackPars .emplace (mchTrackIndex, TrackParExt (fwdtrackutils::getTrackParCovFwd (muonTrack, muonTrack), muonTrack.nClusters ()));
11011105 }
11021106 }
@@ -1105,7 +1109,7 @@ struct GlobalMuonMatching {
11051109 auto mftTrackIndex = mftTrack.globalIndex ();
11061110
11071111 // initialize the MFT track parameters, which will be updated by the alignment corrections if enabled
1108- if (mftTrackCovs.count (mftTrackIndex) >= 0 ) {
1112+ if (mftTrackCovs.count (mftTrackIndex) > 0 && mMftTrackPars . count (mftTrackIndex) = = 0 ) {
11091113 auto const & mftTrackCov = mftCovs.rawIteratorAt (mftTrackCovs[mftTrackIndex]);
11101114 mMftTrackPars .emplace (mftTrackIndex, TrackParExt (fwdtrackutils::getTrackParCovFwd (mftTrack, mftTrackCov), mftTrack.nClusters ()));
11111115 }
@@ -1283,11 +1287,7 @@ struct GlobalMuonMatching {
12831287 }
12841288 }
12851289
1286- template <class C , class TMUON , class TMFT >
1287- void runChi2Matching (C const & collisions,
1288- TMUON const & muonTracks,
1289- TMFT const & mftTracks,
1290- std::string funcName,
1290+ void runChi2Matching (std::string funcName,
12911291 float matchingPlaneZ,
12921292 const MatchingCandidates& matchingCandidates,
12931293 MatchingCandidates& newMatchingCandidates)
@@ -1422,9 +1422,8 @@ struct GlobalMuonMatching {
14221422 }
14231423 }
14241424
1425- template <class C , class BC , class TMUON , class TMFT , class CMFT >
1425+ template <class C , class TMUON , class TMFT , class CMFT >
14261426 void processMatchingCandidates (C const & collisions,
1427- BC const & bcs,
14281427 TMUON const & muonTracks,
14291428 TMFT const & mftTracks,
14301429 CMFT const & mftCovs,
@@ -1444,31 +1443,26 @@ struct GlobalMuonMatching {
14441443 if (configMatching.cfgCustomMatchingStrategy .value == 0 ) {
14451444 if (hasActiveChi2Matching) {
14461445 MatchingCandidates newMatchingCandidates;
1447- runChi2Matching (collisions, muonTracks, mftTracks, activeChi2FunctionName, activeChi2MatchingPlaneZ, mMatchingCandidates , newMatchingCandidates);
1448- fillMatchingCandidates (muonTracks, mftTracks, newMatchingCandidates, taggedMuons);
1446+ runChi2Matching (activeChi2FunctionName, activeChi2MatchingPlaneZ, mMatchingCandidates , newMatchingCandidates);
1447+ fillMatchingCandidates (newMatchingCandidates, taggedMuons);
14491448 }
14501449 } else {
14511450 if (hasActiveMlMatching) {
14521451 MatchingCandidates newMatchingCandidates;
14531452 runMlMatching (collisions, muonTracks, mftTracks, activeMlResponse, activeMlMatchingPlaneZ, mMatchingCandidates , newMatchingCandidates);
1454- fillMatchingCandidates (muonTracks, mftTracks, newMatchingCandidates, taggedMuons);
1453+ fillMatchingCandidates (newMatchingCandidates, taggedMuons);
14551454 }
14561455 }
14571456 }
14581457
1459- template <class TMUON , class TMFT >
1460- void fillMatchingCandidates (TMUON const & muonTracks,
1461- TMFT const & mftTracks,
1462- const MatchingCandidates& matchingCandidates,
1463- const std::vector<int64_t >& taggedMuons)
1458+ void fillMatchingCandidates (const MatchingCandidates& matchingCandidates,
1459+ const std::vector<int64_t >& taggedMuons)
14641460 {
14651461 for (const auto & [mchIndex, candidates] : matchingCandidates) {
14661462 if (candidates.empty ()) {
14671463 continue ;
14681464 }
14691465
1470- const auto & mchTrack = muonTracks.rawIteratorAt (mchIndex);
1471-
14721466 bool isTagged = std::find (taggedMuons.begin (), taggedMuons.end (), mchIndex) != taggedMuons.end ();
14731467
14741468 std::vector<MatchingCandidate> storedCandidates;
@@ -1508,9 +1502,8 @@ struct GlobalMuonMatching {
15081502 return static_cast <int32_t >(candidateIterator->second .size ());
15091503 }
15101504
1511- template <class TCOLLISION , class TMUON , class TMFT >
1512- void fillGmmCandidateFwdTracks (TCOLLISION const & collisions,
1513- TMUON const & muonTracks,
1505+ template <class TMUON , class TMFT >
1506+ void fillGmmCandidateFwdTracks (TMUON const & muonTracks,
15141507 TMFT const & mftTracks)
15151508 {
15161509 if (!configMatching.cfgProduceCandidateFwdTracks .value ) {
@@ -1548,12 +1541,10 @@ struct GlobalMuonMatching {
15481541 fillBaseGmmCandFwdTrack (track, trackPar, gmmMchTrackId, -1 .f , -1 .f );
15491542 } else {
15501543 // fill muon tracks table with realignment parameters
1551- fillBaseGmmCandFwdTrack (track, mchTrackParIt->second , gmmMchTrackId, -1 , false , - 1 .f , -1 .f );
1544+ fillBaseGmmCandFwdTrack (track, mchTrackParIt->second , gmmMchTrackId, -1 .f , -1 .f );
15521545 }
15531546
1554- if (candidateIterator != mMchTrackMatchingCandidates .end () && track.has_collision ()) {
1555- const auto & collision = collisions.rawIteratorAt (track.collisionId ());
1556- const bool isTagged = mMchTrackIsTagged [mchTrackIndex];
1547+ if (candidateIterator != mMchTrackMatchingCandidates .end ()) {
15571548 for (const auto & candidate : candidateIterator->second ) {
15581549 auto mftTrackParIt = mMftTrackPars .find (candidate.mftTrackId );
15591550 if (mftTrackParIt != mMftTrackPars .end ()) {
@@ -1620,19 +1611,18 @@ struct GlobalMuonMatching {
16201611 mMchTrackToCandidateIndices .clear ();
16211612 mMchTrackMatchingCandidates .clear ();
16221613 mFwdTrackToGmmCandTrkIndex .clear ();
1623- mMchTrackPars .clear ();
16241614
16251615 LOGF (info, " Preparing candidates" );
16261616 prepareMatchingCandidates (collisions, bcs, muonTracks, mftTracks, mftCovs);
16271617
16281618 LOGF (info, " Processing candidates" );
1629- processMatchingCandidates (collisions, bcs, muonTracks, mftTracks, mftCovs, clusters);
1619+ processMatchingCandidates (collisions, muonTracks, mftTracks, mftCovs, clusters);
16301620
16311621 LOGF (info, " Filling tables" );
16321622 // fill table with track/candidates index mapping
16331623 fillFwdTrkMatchCands (muonTracks);
16341624 // fill track tables
1635- fillGmmCandidateFwdTracks (collisions, muonTracks, mftTracks);
1625+ fillGmmCandidateFwdTracks (muonTracks, mftTracks);
16361626 }
16371627
16381628 PROCESS_SWITCH (GlobalMuonMatching, processData, " processData" , true );
0 commit comments