@@ -1999,6 +1999,21 @@ struct QaMatching {
19991999 return attempts;
20002000 }
20012001
2002+ template <class TMUON >
2003+ void getMatchChi2AndScore (TMUON const & muonTrack, float & matchChi2, float & matchScore)
2004+ {
2005+ matchChi2 = muonTrack.chi2MatchMCHMFT () / MatchingDegreesOfFreedom;
2006+ matchScore = muonTrack.matchScoreMCHMFT ();
2007+ if (matchScore >= 0 && matchChi2 < 0 ) {
2008+ // match score from ML-based matching, we compute a chi2-like value from the score
2009+ float matchScoreInv = (matchScore > 0 ) ? 1.0 / matchScore : std::numeric_limits<float >::max ();
2010+ matchChi2 = matchScoreInv - 1 .f ;
2011+ } else {
2012+ // we assume a standard chi2-based matching, and compute the score value from the chi2
2013+ matchScore = chi2ToScore (muonTrack.chi2MatchMCHMFT (), MatchingDegreesOfFreedom, MatchingScoreChi2Max);
2014+ }
2015+ }
2016+
20022017 template <bool isMC, class EVT , class BC , class TMUON , class TMFT >
20032018 void fillCollisions (EVT const & collisions,
20042019 BC const & bcs,
@@ -2052,8 +2067,10 @@ struct QaMatching {
20522067 } else {
20532068 // global muon tracks (MFT-MCH or MFT-MCH-MID)
20542069 int64_t muonTrackIndex = muonTrack.globalIndex ();
2055- double matchChi2 = muonTrack.chi2MatchMCHMFT () / MatchingDegreesOfFreedom;
2056- double matchScore = chi2ToScore (muonTrack.chi2MatchMCHMFT (), MatchingDegreesOfFreedom, MatchingScoreChi2Max);
2070+ float matchChi2{-1 };
2071+ float matchScore{-1 };
2072+ getMatchChi2AndScore (muonTrack, matchChi2, matchScore);
2073+
20572074 auto const & mchTrack = muonTrack.template matchMCHTrack_as <TMUON >();
20582075 int64_t mchTrackIndex = mchTrack.globalIndex ();
20592076 auto const & mftTrack = muonTrack.template matchMFTTrack_as <TMFT >();
@@ -2902,8 +2919,12 @@ struct QaMatching {
29022919 std::vector<float > inputML = mlResponse.getInputFeatures (muonTrack, mftTrack, mchTrack, mftTrackProp, mchTrackProp, collision);
29032920 mlResponse.isSelectedMl (inputML, 0 , output);
29042921 float matchScore = output[0 ];
2905- float matchChi2Prod = muonTrack.chi2MatchMCHMFT () / MatchingDegreesOfFreedom;
2906- float matchScoreProd = chi2ToScore (muonTrack.chi2MatchMCHMFT (), MatchingDegreesOfFreedom, MatchingScoreChi2Max);
2922+ float matchScoreInv = (matchScore > 0 ) ? 1.0 / matchScore : std::numeric_limits<float >::max ();
2923+ float matchChi2 = matchScoreInv - 1 .f ;
2924+
2925+ float matchChi2Prod{-1 };
2926+ float matchScoreProd{-1 };
2927+ getMatchChi2AndScore (muonTrack, matchChi2Prod, matchScoreProd);
29072928
29082929 // check if a vector of global muon candidates is already available for the current MCH index
29092930 // if not, initialize a new one and add the current global muon track
@@ -2917,7 +2938,7 @@ struct QaMatching {
29172938 mftTrackProp,
29182939 mchTrackProp,
29192940 matchScore,
2920- - 1 ,
2941+ matchChi2 ,
29212942 -1 ,
29222943 matchScoreProd,
29232944 matchChi2Prod,
@@ -2932,7 +2953,7 @@ struct QaMatching {
29322953 mftTrackProp,
29332954 mchTrackProp,
29342955 matchScore,
2935- - 1 ,
2956+ matchChi2 ,
29362957 -1 ,
29372958 matchScoreProd,
29382959 matchChi2Prod,
0 commit comments