@@ -773,7 +773,7 @@ struct QaMatching {
773773 // -
774774 AxisSpec chi2Axis = {100 , 0 , 100 , " matching #chi^{2}/NDF" };
775775 AxisSpec scoreAxis = {100 , 0 , 1 , " matching score" };
776- int matchTypeMax = static_cast <int >(kMatchTypeUndefined );
776+ int matchTypeMax = static_cast <int >(kMatchTypeUndefined ) + 1 ;
777777 AxisSpec matchTypeAxis = {matchTypeMax, 0 , static_cast <double >(matchTypeMax), " match type" };
778778 histName = path + " matchType" ;
779779 histTitle = " Match type" ;
@@ -786,6 +786,7 @@ struct QaMatching {
786786 std::get<std::shared_ptr<TH1>>(fMatchType )->GetXaxis ()->SetBinLabel (6 , " wrong (non leading)" );
787787 std::get<std::shared_ptr<TH1>>(fMatchType )->GetXaxis ()->SetBinLabel (7 , " decay (non leading)" );
788788 std::get<std::shared_ptr<TH1>>(fMatchType )->GetXaxis ()->SetBinLabel (8 , " fake (non leading)" );
789+ std::get<std::shared_ptr<TH1>>(fMatchType )->GetXaxis ()->SetBinLabel (9 , " undefined" );
789790 histName = path + " matchTypeVsP" ;
790791 histTitle = " Match type vs. p" ;
791792 fMatchTypeVsP = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH2F , {pAxis, matchTypeAxis}});
@@ -797,6 +798,7 @@ struct QaMatching {
797798 std::get<std::shared_ptr<TH2>>(fMatchTypeVsP )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
798799 std::get<std::shared_ptr<TH2>>(fMatchTypeVsP )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
799800 std::get<std::shared_ptr<TH2>>(fMatchTypeVsP )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
801+ std::get<std::shared_ptr<TH2>>(fMatchTypeVsP )->GetYaxis ()->SetBinLabel (9 , " undefined" );
800802 histName = path + " matchTypeVsPt" ;
801803 histTitle = " Match type vs. p_{T}" ;
802804 fMatchTypeVsPt = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH2F , {ptAxis, matchTypeAxis}});
@@ -808,6 +810,7 @@ struct QaMatching {
808810 std::get<std::shared_ptr<TH2>>(fMatchTypeVsPt )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
809811 std::get<std::shared_ptr<TH2>>(fMatchTypeVsPt )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
810812 std::get<std::shared_ptr<TH2>>(fMatchTypeVsPt )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
813+ std::get<std::shared_ptr<TH2>>(fMatchTypeVsPt )->GetYaxis ()->SetBinLabel (9 , " undefined" );
811814
812815 histName = path + " matchChi2VsType" ;
813816 histTitle = " Match #chi^{2} vs. match type" ;
@@ -820,6 +823,7 @@ struct QaMatching {
820823 std::get<std::shared_ptr<TH2>>(fMatchChi2VsType )->GetXaxis ()->SetBinLabel (6 , " wrong (non leading)" );
821824 std::get<std::shared_ptr<TH2>>(fMatchChi2VsType )->GetXaxis ()->SetBinLabel (7 , " decay (non leading)" );
822825 std::get<std::shared_ptr<TH2>>(fMatchChi2VsType )->GetXaxis ()->SetBinLabel (8 , " fake (non leading)" );
826+ std::get<std::shared_ptr<TH2>>(fMatchChi2VsType )->GetXaxis ()->SetBinLabel (9 , " undefined" );
823827 histName = path + " matchChi2VsTypeVsP" ;
824828 histTitle = " Match #chi^{2} vs. match type vs. p" ;
825829 fMatchChi2VsTypeVsP = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH3F , {pAxis, matchTypeAxis, chi2Axis}});
@@ -831,6 +835,7 @@ struct QaMatching {
831835 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsP )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
832836 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsP )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
833837 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsP )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
838+ std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsP )->GetYaxis ()->SetBinLabel (9 , " undefined" );
834839 histName = path + " matchChi2VsTypeVsPt" ;
835840 histTitle = " Match #chi^{2} vs. match type vs. p_{T}" ;
836841 fMatchChi2VsTypeVsPt = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH3F , {ptAxis, matchTypeAxis, chi2Axis}});
@@ -842,6 +847,7 @@ struct QaMatching {
842847 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsPt )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
843848 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsPt )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
844849 std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsPt )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
850+ std::get<std::shared_ptr<TH3>>(fMatchChi2VsTypeVsPt )->GetYaxis ()->SetBinLabel (9 , " undefined" );
845851 // -
846852 histName = path + " matchScoreVsType" ;
847853 histTitle = " Match score vs. match type" ;
@@ -854,6 +860,7 @@ struct QaMatching {
854860 std::get<std::shared_ptr<TH2>>(fMatchScoreVsType )->GetXaxis ()->SetBinLabel (6 , " wrong (non leading)" );
855861 std::get<std::shared_ptr<TH2>>(fMatchScoreVsType )->GetXaxis ()->SetBinLabel (7 , " decay (non leading)" );
856862 std::get<std::shared_ptr<TH2>>(fMatchScoreVsType )->GetXaxis ()->SetBinLabel (8 , " fake (non leading)" );
863+ std::get<std::shared_ptr<TH2>>(fMatchScoreVsType )->GetXaxis ()->SetBinLabel (9 , " undefined" );
857864 histName = path + " matchScoreVsTypeVsP" ;
858865 histTitle = " Match score vs. match type vs. p" ;
859866 fMatchScoreVsTypeVsP = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH3F , {pAxis, matchTypeAxis, scoreAxis}});
@@ -865,6 +872,7 @@ struct QaMatching {
865872 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsP )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
866873 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsP )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
867874 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsP )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
875+ std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsP )->GetYaxis ()->SetBinLabel (9 , " undefined" );
868876 histName = path + " matchScoreVsTypeVsPt" ;
869877 histTitle = " Match score vs. match type vs. p_{T}" ;
870878 fMatchScoreVsTypeVsPt = registry->add (histName.c_str (), histTitle.c_str (), {HistType::kTH3F , {ptAxis, matchTypeAxis, scoreAxis}});
@@ -876,6 +884,7 @@ struct QaMatching {
876884 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsPt )->GetYaxis ()->SetBinLabel (6 , " wrong (non leading)" );
877885 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsPt )->GetYaxis ()->SetBinLabel (7 , " decay (non leading)" );
878886 std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsPt )->GetYaxis ()->SetBinLabel (8 , " fake (non leading)" );
887+ std::get<std::shared_ptr<TH3>>(fMatchScoreVsTypeVsPt )->GetYaxis ()->SetBinLabel (9 , " undefined" );
879888
880889 AxisSpec prodScoreAxis = {100 , 0 , 1 , " matching score (prod)" };
881890 histName = path + " matchScoreVsProd" ;
@@ -1673,8 +1682,6 @@ struct QaMatching {
16731682 continue ;
16741683 // get the index associated to the MC particle
16751684 auto muonMcParticle = muonTrack.mcParticle ();
1676- if (std::abs (muonMcParticle.pdgCode ()) != kMuonMinus )
1677- continue ;
16781685
16791686 int64_t muonMcTrackIndex = muonMcParticle.globalIndex ();
16801687
@@ -1741,8 +1748,7 @@ struct QaMatching {
17411748 TMUONS const & /* muonTracks*/ ,
17421749 TMFTS const & /* mftTracks*/ )
17431750 {
1744- static constexpr int maxGlobalFwdTrackType = 2 ;
1745- if (static_cast <int >(muonTrack.trackType ()) >= maxGlobalFwdTrackType)
1751+ if (static_cast <int >(muonTrack.trackType ()) >= GlobalTrackTypeMax)
17461752 return false ;
17471753
17481754 auto const & mchTrack = muonTrack.template matchMCHTrack_as <TMUONS>();
@@ -1995,7 +2001,7 @@ struct QaMatching {
19952001 if (collisionIds.empty ())
19962002 return ;
19972003
1998- for (size_t cid = 1 ; cid < collisionIds.size () - 1 ; cid++) {
2004+ for (size_t cid = 0 ; cid < collisionIds.size (); cid++) {
19992005 const auto & collision = collisions.rawIteratorAt (collisionIds[cid]);
20002006 int64_t collisionIndex = collision.globalIndex ();
20012007 auto bc = bcs.rawIteratorAt (collision.bcId ());
@@ -2088,17 +2094,17 @@ struct QaMatching {
20882094 }
20892095 }
20902096
2091- // sort the vectors of matching candidates in ascending order based on the matching score value
2092- auto compareMatchingScore = [](const MatchingCandidate& track1, const MatchingCandidate& track2) -> bool {
2093- return (track1.matchScore > track2.matchScore );
2097+ // sort the vectors of matching candidates in ascending order based on the matching chi2 value
2098+ auto compareMatchingChi2 = [](const MatchingCandidate& track1, const MatchingCandidate& track2) -> bool {
2099+ return (track1.matchChi2 < track2.matchChi2 );
20942100 };
20952101
20962102 for (auto collisionInfoIt = collisionInfos.begin (); collisionInfoIt != collisionInfos.end (); ++collisionInfoIt) {
20972103 auto & collisionInfo = collisionInfoIt->second ;
20982104 for (auto matchingCandidatesIt = collisionInfo.matchingCandidates .begin (); matchingCandidatesIt != collisionInfo.matchingCandidates .end (); ++matchingCandidatesIt) {
20992105 auto & mchIndex = matchingCandidatesIt->first ;
21002106 auto & globalTracksVector = matchingCandidatesIt->second ;
2101- std::sort (globalTracksVector.begin (), globalTracksVector.end (), compareMatchingScore );
2107+ std::sort (globalTracksVector.begin (), globalTracksVector.end (), compareMatchingChi2 );
21022108
21032109 const auto & mchTrack = muonTracks.rawIteratorAt (mchIndex);
21042110 auto mftMchMatchAttempts = getMftMchMatchAttempts (collisions, bcs, mchTrack, mftTracks);
@@ -2620,15 +2626,15 @@ struct QaMatching {
26202626 }
26212627 }
26222628
2623- // sort the vectors of matching candidates in ascending order based on the matching score value
2624- auto compareMatchingScore = [](const MatchingCandidate& track1, const MatchingCandidate& track2) -> bool {
2625- return (track1.matchScore > track2.matchScore );
2629+ // sort the vectors of matching candidates in ascending order based on the matching chi2 value
2630+ auto compareMatchingChi2 = [](const MatchingCandidate& track1, const MatchingCandidate& track2) -> bool {
2631+ return (track1.matchChi2 < track2.matchChi2 );
26262632 };
26272633
26282634 for (auto matchingCandidatesIt = newMatchingCandidates.begin (); matchingCandidatesIt != newMatchingCandidates.end (); ++matchingCandidatesIt) {
26292635 auto & mchIndex = matchingCandidatesIt->first ;
26302636 auto & globalTracksVector = matchingCandidatesIt->second ;
2631- std::sort (globalTracksVector.begin (), globalTracksVector.end (), compareMatchingScore );
2637+ std::sort (globalTracksVector.begin (), globalTracksVector.end (), compareMatchingChi2 );
26322638
26332639 const auto & mchTrack = muonTracks.rawIteratorAt (mchIndex);
26342640 auto mftMchMatchAttempts = getMftMchMatchAttempts (collisions, bcs, mchTrack, mftTracks);
0 commit comments