@@ -681,27 +681,30 @@ struct QaMatching {
681681
682682 MatchFeaturesHistos (std::string path, HistogramRegistry* registry, int numCandidates)
683683 {
684- AxisSpec indexAxis = {numCandidates + 1 , 0 , static_cast <double >(numCandidates + 1 ), " ranking index" };
684+ AxisSpec indexAxis = {numCandidates, 0 , static_cast <double >(numCandidates), " ranking index" };
685685 AxisSpec scoreAxis = {100 , 0 , 1 , " match score" };
686686 int matchTypeMax = static_cast <int >(kMatchTypeUndefined ) + 1 ;
687687 AxisSpec matchTypeAxis = {matchTypeMax, 0 , static_cast <double >(matchTypeMax), " match type" };
688- AxisSpec dxAxis = {100 , -10 , 10 , " #Deltax (cm)" };
689- AxisSpec dyAxis = {100 , -10 , 10 , " #Deltay (cm)" };
690- AxisSpec dpAxis = {100 , -10 , 10 , " #Deltap (GeV/c)" };
691- AxisSpec dptAxis = {100 , -1 , 1 , " #Deltap_{T} (GeV/c)" };
692- AxisSpec dphiAxis = {100 , -1 , 1 , " #Delta#phi (rad)" };
693- AxisSpec dtanlAxis = {100 , -10 , 10 , " #Deltatanl" };
694- AxisSpec detaAxis = {100 , -1 , 1 , " #Delta#eta" };
688+ AxisSpec taggedAxis = {2 , 0 , 2.0 , " is tagged" };
689+ AxisSpec scoreGapAxis = {100 , 0 , 1.0 , " match score gap" };
690+ AxisSpec logpAxis = {16 , -1 , 3 , " log_{10}(p)" };
691+ AxisSpec dxAxis = {100 , -20 , 20 , " #Deltax (cm)" };
692+ AxisSpec dyAxis = {100 , -20 , 20 , " #Deltay (cm)" };
693+ AxisSpec dpAxis = {100 , -50 , 50 , " #Deltap (GeV/c)" };
694+ AxisSpec dptAxis = {100 , -5 , 5 , " #Deltap_{T} (GeV/c)" };
695+ AxisSpec dphiAxis = {100 , -2 , 2 , " #Delta#phi (rad)" };
696+ AxisSpec dtanlAxis = {100 , -20 , 20 , " #Deltatanl" };
697+ AxisSpec detaAxis = {100 , -2 , 2 , " #Delta#eta" };
695698 AxisSpec rabsAxis = {100 , 0 , 100 , " R_{abs}" };
696699
697- hDeltaP = registry->add ((path + " /deltaP" ).c_str (), " MFT-MCH #Deltap" , {HistType::kTHnSparseF , {dpAxis, scoreAxis, indexAxis, matchTypeAxis}});
698- hDeltaPt = registry->add ((path + " /deltaPt" ).c_str (), " MFT-MCH #Deltap_{T}" , {HistType::kTHnSparseF , {dptAxis, scoreAxis, indexAxis, matchTypeAxis}});
699- hDeltaX = registry->add ((path + " /deltaX" ).c_str (), " MFT-MCH #Deltax" , {HistType::kTHnSparseF , {dxAxis, scoreAxis, indexAxis, matchTypeAxis}});
700- hDeltaY = registry->add ((path + " /deltaY" ).c_str (), " MFT-MCH #Deltay" , {HistType::kTHnSparseF , {dyAxis, scoreAxis, indexAxis, matchTypeAxis}});
701- hDeltaPhi = registry->add ((path + " /deltaPhi" ).c_str (), " MFT-MCH #Delta#phi" , {HistType::kTHnSparseF , {dphiAxis, scoreAxis, indexAxis, matchTypeAxis}});
702- hDeltaTanl = registry->add ((path + " /deltaTanl" ).c_str (), " MFT-MCH #DeltaTanl" , {HistType::kTHnSparseF , {dtanlAxis, scoreAxis, indexAxis, matchTypeAxis}});
703- hDeltaEta = registry->add ((path + " /deltaEta" ).c_str (), " MFT-MCH #Delta#eta" , {HistType::kTHnSparseF , {detaAxis, scoreAxis, indexAxis, matchTypeAxis}});
704- hRabs = registry->add ((path + " /Rabs" ).c_str (), " MFT-MCH R_{abs}" , {HistType::kTHnSparseF , {rabsAxis, scoreAxis, indexAxis, matchTypeAxis}});
700+ hDeltaP = registry->add ((path + " /deltaP" ).c_str (), " MFT-MCH #Deltap" , {HistType::kTHnSparseF , {dpAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
701+ hDeltaPt = registry->add ((path + " /deltaPt" ).c_str (), " MFT-MCH #Deltap_{T}" , {HistType::kTHnSparseF , {dptAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
702+ hDeltaX = registry->add ((path + " /deltaX" ).c_str (), " MFT-MCH #Deltax" , {HistType::kTHnSparseF , {dxAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
703+ hDeltaY = registry->add ((path + " /deltaY" ).c_str (), " MFT-MCH #Deltay" , {HistType::kTHnSparseF , {dyAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
704+ hDeltaPhi = registry->add ((path + " /deltaPhi" ).c_str (), " MFT-MCH #Delta#phi" , {HistType::kTHnSparseF , {dphiAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
705+ hDeltaTanl = registry->add ((path + " /deltaTanl" ).c_str (), " MFT-MCH #DeltaTanl" , {HistType::kTHnSparseF , {dtanlAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
706+ hDeltaEta = registry->add ((path + " /deltaEta" ).c_str (), " MFT-MCH #Delta#eta" , {HistType::kTHnSparseF , {detaAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
707+ hRabs = registry->add ((path + " /Rabs" ).c_str (), " MFT-MCH R_{abs}" , {HistType::kTHnSparseF , {rabsAxis, logpAxis, scoreAxis, scoreGapAxis, indexAxis, matchTypeAxis, taggedAxis }});
705708 }
706709 };
707710
@@ -2152,6 +2155,7 @@ struct QaMatching {
21522155 template <class C , class TMUON >
21532156 void fillMatchingPlots (C const & collision,
21542157 TMUON const & muonTracks,
2158+ const std::vector<int64_t >& taggedMuons,
21552159 const MatchingCandidates& matchingCandidates,
21562160 MatchingPlotter* plotter)
21572161 {
@@ -2168,6 +2172,22 @@ struct QaMatching {
21682172 if (!isGoodGlobalMuon (mchTrack, collision))
21692173 continue ;
21702174
2175+ double logp = std::log10 (mchTrack.p ());
2176+
2177+ int isTagged = 0 ;
2178+ if (std::find (taggedMuons.begin (), taggedMuons.end (), mchIndex) != taggedMuons.end ()) {
2179+ isTagged = 1 ;
2180+ }
2181+
2182+ float scoreGap = 0 ;
2183+ if (globalTracksVector.size () > 1 ) {
2184+ // we have at least two candidates, so we can check the score difference
2185+ // between the leading and the sub-leading
2186+ auto leadingScore = globalTracksVector[0 ].matchScore ;
2187+ auto subleadingScore = globalTracksVector[1 ].matchScore ;
2188+ scoreGap = leadingScore - subleadingScore;
2189+ }
2190+
21712191 for (const auto & candidate : globalTracksVector) {
21722192 double dp = candidate.mchTrackProp .getP () - candidate.mftTrackProp .getP ();
21732193 double dpt = candidate.mchTrackProp .getPt () - candidate.mftTrackProp .getPt ();
@@ -2177,14 +2197,15 @@ struct QaMatching {
21772197 double dtanl = candidate.mchTrackProp .getTanl () - candidate.mftTrackProp .getTanl ();
21782198 double deta = candidate.mchTrackProp .getEta () - candidate.mftTrackProp .getEta ();
21792199 int matchType = static_cast <int >(candidate.matchType );
2180- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaP )->Fill (dp, candidate.matchScore , candidate.matchRanking , matchType);
2181- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPt )->Fill (dpt, candidate.matchScore , candidate.matchRanking , matchType);
2182- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaX )->Fill (dx, candidate.matchScore , candidate.matchRanking , matchType);
2183- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaY )->Fill (dy, candidate.matchScore , candidate.matchRanking , matchType);
2184- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPhi )->Fill (dphi, candidate.matchScore , candidate.matchRanking , matchType);
2185- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaTanl )->Fill (dtanl, candidate.matchScore , candidate.matchRanking , matchType);
2186- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaEta )->Fill (deta, candidate.matchScore , candidate.matchRanking , matchType);
2187- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hRabs )->Fill (mchTrack.rAtAbsorberEnd (), candidate.matchScore , candidate.matchRanking , matchType);
2200+ int ranking = candidate.matchRanking - 1 ;
2201+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaP )->Fill (dp, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2202+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPt )->Fill (dpt, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2203+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaX )->Fill (dx, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2204+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaY )->Fill (dy, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2205+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPhi )->Fill (dphi, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2206+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaTanl )->Fill (dtanl, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2207+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaEta )->Fill (deta, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2208+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hRabs )->Fill (mchTrack.rAtAbsorberEnd (), logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
21882209 }
21892210 }
21902211
@@ -2215,6 +2236,7 @@ struct QaMatching {
22152236 const CollisionInfo& collisionInfo,
22162237 TMUON const & muonTracks,
22172238 TMFT const & mftTracks,
2239+ const std::vector<int64_t >& taggedMuons,
22182240 const MatchingCandidates& matchingCandidates,
22192241 const MatchingCandidates& matchingCandidatesProd,
22202242 const std::vector<std::pair<int64_t , int64_t >>& matchablePairs,
@@ -2315,6 +2337,22 @@ struct QaMatching {
23152337 }
23162338
23172339 if (isGoodMCH) {
2340+ double logp = std::log10 (mchTrack.p ());
2341+
2342+ int isTagged = 0 ;
2343+ if (std::find (taggedMuons.begin (), taggedMuons.end (), mchIndex) != taggedMuons.end ()) {
2344+ isTagged = 1 ;
2345+ }
2346+
2347+ float scoreGap = 0 ;
2348+ if (globalTracksVector.size ()) {
2349+ // we have a matchable pair with at least two candidates, so we can check the score difference
2350+ // between the leading and the sub-leading
2351+ auto leadingScore = globalTracksVector[0 ].matchScore ;
2352+ auto subleadingScore = globalTracksVector[1 ].matchScore ;
2353+ scoreGap = leadingScore - subleadingScore;
2354+ }
2355+
23182356 for (const auto & candidate : globalTracksVector) {
23192357 double dp = candidate.mchTrackProp .getP () - candidate.mftTrackProp .getP ();
23202358 double dpt = candidate.mchTrackProp .getPt () - candidate.mftTrackProp .getPt ();
@@ -2324,14 +2362,15 @@ struct QaMatching {
23242362 double dtanl = candidate.mchTrackProp .getTanl () - candidate.mftTrackProp .getTanl ();
23252363 double deta = candidate.mchTrackProp .getEta () - candidate.mftTrackProp .getEta ();
23262364 int matchType = static_cast <int >(candidate.matchType );
2327- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaP )->Fill (dp, candidate.matchScore , candidate.matchRanking , matchType);
2328- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPt )->Fill (dpt, candidate.matchScore , candidate.matchRanking , matchType);
2329- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaX )->Fill (dx, candidate.matchScore , candidate.matchRanking , matchType);
2330- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaY )->Fill (dy, candidate.matchScore , candidate.matchRanking , matchType);
2331- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPhi )->Fill (dphi, candidate.matchScore , candidate.matchRanking , matchType);
2332- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaTanl )->Fill (dtanl, candidate.matchScore , candidate.matchRanking , matchType);
2333- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaEta )->Fill (deta, candidate.matchScore , candidate.matchRanking , matchType);
2334- std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hRabs )->Fill (mchTrack.rAtAbsorberEnd (), candidate.matchScore , candidate.matchRanking , matchType);
2365+ int ranking = candidate.matchRanking - 1 ;
2366+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaP )->Fill (dp, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2367+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPt )->Fill (dpt, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2368+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaX )->Fill (dx, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2369+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaY )->Fill (dy, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2370+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaPhi )->Fill (dphi, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2371+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaTanl )->Fill (dtanl, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2372+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hDeltaEta )->Fill (deta, logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
2373+ std::get<std::shared_ptr<THnSparse>>(plotter->fMatchFeaturesGoodMCH ->hRabs )->Fill (mchTrack.rAtAbsorberEnd (), logp, candidate.matchScore , scoreGap, ranking, matchType, isTagged);
23352374 }
23362375 }
23372376
@@ -2937,9 +2976,9 @@ struct QaMatching {
29372976 // Chi2-based matching from production
29382977 fillQaMatchingAodTablesForCollision (collision, muonTracks, mftTracks, collisionInfo.matchingCandidates , matchingMethodCounter, collisionInfo.reducedEventId , collisionInfo.reducedMchTrackIds );
29392978 if constexpr (isMC) {
2940- fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, collisionInfo.matchingCandidates , collisionInfo.matchingCandidates , collisionInfo.matchablePairs , cfgMatchingChi2ScoreMftMchLow, fChi2MatchingPlotter .get (), false );
2979+ fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, taggedMuons, collisionInfo.matchingCandidates , collisionInfo.matchingCandidates , collisionInfo.matchablePairs , cfgMatchingChi2ScoreMftMchLow, fChi2MatchingPlotter .get (), false );
29412980 } else {
2942- fillMatchingPlots (collision, muonTracks, collisionInfo.matchingCandidates , fChi2MatchingPlotter .get ());
2981+ fillMatchingPlots (collision, muonTracks, taggedMuons, collisionInfo.matchingCandidates , fChi2MatchingPlotter .get ());
29432982 }
29442983
29452984 // -------------------------------
@@ -2974,9 +3013,9 @@ struct QaMatching {
29743013 }
29753014 }
29763015 if constexpr (isMC) {
2977- fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, taggedMatchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , cfgMatchingChi2ScoreMftMchLow, fTaggedMuonsMatchingPlotter .get ());
3016+ fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, taggedMuons, taggedMatchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , cfgMatchingChi2ScoreMftMchLow, fTaggedMuonsMatchingPlotter .get ());
29783017 } else {
2979- fillMatchingPlots (collision, muonTracks, taggedMatchingCandidates, fTaggedMuonsMatchingPlotter .get ());
3018+ fillMatchingPlots (collision, muonTracks, taggedMuons, taggedMatchingCandidates, fTaggedMuonsMatchingPlotter .get ());
29803019 }
29813020
29823021 // -------------------------------
@@ -2991,9 +3030,9 @@ struct QaMatching {
29913030 matchingMethodCounter += 1 ;
29923031 fillQaMatchingAodTablesForCollision (collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId , collisionInfo.reducedMchTrackIds );
29933032 if constexpr (isMC) {
2994- fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, matchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , matchingScoreCut, plotter, false );
3033+ fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, taggedMuons, matchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , matchingScoreCut, plotter, false );
29953034 } else {
2996- fillMatchingPlots (collision, muonTracks, matchingCandidates, plotter);
3035+ fillMatchingPlots (collision, muonTracks, taggedMuons, matchingCandidates, plotter);
29973036 }
29983037 }
29993038
@@ -3009,9 +3048,9 @@ struct QaMatching {
30093048 matchingMethodCounter += 1 ;
30103049 fillQaMatchingAodTablesForCollision (collision, muonTracks, mftTracks, matchingCandidates, matchingMethodCounter, collisionInfo.reducedEventId , collisionInfo.reducedMchTrackIds );
30113050 if constexpr (isMC) {
3012- fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, matchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , matchingScoreCut, plotter);
3051+ fillMatchingPlotsMc (collision, collisionInfo, muonTracks, mftTracks, taggedMuons, matchingCandidates, collisionInfo.matchingCandidates , collisionInfo.matchablePairs , matchingScoreCut, plotter);
30133052 } else {
3014- fillMatchingPlots (collision, muonTracks, matchingCandidates, plotter);
3053+ fillMatchingPlots (collision, muonTracks, taggedMuons, matchingCandidates, plotter);
30153054 }
30163055 }
30173056
0 commit comments