@@ -226,6 +226,7 @@ struct matchingMFT {
226226 fRegistry .add (" MFTMCHMID/primary/correct/hDCAxyz" , " DCA xy vs. z;DCA_{xy} (cm);DCA_{z} (cm);" , kTH2F , {{100 , 0 , 1 }, {200 , -0.1 , 0.1 }}, false );
227227 fRegistry .add (" MFTMCHMID/primary/correct/hMCHBitMap" , " MCH bit map;MCH bit map" , kTH1F , {{1024 , -0.5 , 1023.5 }}, false );
228228 fRegistry .add (" MFTMCHMID/primary/correct/hMIDBitMap" , " MID bit map;MID bit map" , kTH1F , {{256 , -0.5 , 255.5 }}, false );
229+ fRegistry .add (" MFTMCHMID/primary/correct/hdR_Chi2MatchMCHMFT" , " dr vs. matching chi2 MCH-MFT;chi2 match MCH-MFT;#DeltaR" , kTH2F , {{200 , 0 , 50 }, {200 , 0 , 0.5 }}, false );
229230 fRegistry .add (" MFTMCHMID/primary/correct/hCorrectAsocc" , " correct fwdtrack-to-collision association" , kTH1F , {{2 , -0.5 , +1.5 }}, false );
230231 fRegistry .add (" MFTMCHMID/primary/correct/hIsCA" , " cellular automaton;isCA" , kTH1F , {{2 , -0.5 , 1.5 }}, false );
231232 fRegistry .add (" MFTMCHMID/primary/correct/hProdVtxZ" , " prod. vtx Z of muon;V_{z} (cm)" , kTH1F , {{200 , -100 , 100 }}, false );
@@ -744,7 +745,7 @@ struct matchingMFT {
744745 std::map<std::tuple<int , int , int >, bool > mapCorrectMatch;
745746
746747 template <bool withMFTCov, typename TCollision, typename TFwdTrack, typename TFwdTracks, typename TMFTTracks, typename TMFTTracksCov>
747- void findBestMatchPerMCHMID (TCollision const & collision, TFwdTrack const & fwdtrack, TFwdTracks const & fwdtracks, TMFTTracks const &, TMFTTracksCov const & mftCovs )
748+ void findBestMatchPerMCHMID (TCollision const & collision, TFwdTrack const & fwdtrack, TFwdTracks const & fwdtracks, TMFTTracks const &, TMFTTracksCov const &)
748749 {
749750 if (fwdtrack.trackType () != o2::aod::fwdtrack::ForwardTrackTypeEnum::MuonStandaloneTrack) {
750751 return ;
@@ -760,6 +761,11 @@ struct matchingMFT {
760761 auto muons_per_MCHMID = fwdtracks.sliceBy (fwdtracksPerMCHTrack, fwdtrack.globalIndex ());
761762 // LOGF(info, "muons_per_MCHMID.size() = %d", muons_per_MCHMID.size());
762763
764+ o2::dataformats::GlobalFwdTrack propmuonAtPV_Matched = propagateMuon (fwdtrack, fwdtrack, collision, propagationPoint::kToVertex , matchingZ, mBz , mZShift );
765+ float etaMatchedMCHMID = propmuonAtPV_Matched.getEta ();
766+ float phiMatchedMCHMID = propmuonAtPV_Matched.getPhi ();
767+ o2::math_utils::bringTo02Pi (phiMatchedMCHMID);
768+
763769 for (const auto & muon_tmp : muons_per_MCHMID) {
764770 if (muon_tmp.trackType () == o2::aod::fwdtrack::ForwardTrackTypeEnum::GlobalMuonTrack) {
765771
@@ -771,17 +777,44 @@ struct matchingMFT {
771777 continue ;
772778 }
773779
774- float dx = 999 .f , dy = 999 .f ;
775- if constexpr (withMFTCov) {
776- getDxDyAtMatchingPlane<TFwdTracks, TMFTTracks>(collision, muon_tmp, mftCovs, dx, dy);
777- }
778- float dr = std::sqrt (dx * dx + dy * dy);
780+ // float dx = 999.f, dy = 999.f;
781+ // if constexpr (withMFTCov) {
782+ // getDxDyAtMatchingPlane<TFwdTracks, TMFTTracks>(collision, muon_tmp, mftCovs, dx, dy);
783+ // }
784+ // float dr = std::sqrt(dx * dx + dy * dy);
785+
786+ o2::dataformats::GlobalFwdTrack propmuonAtPV = propagateMuon (muon_tmp, muon_tmp, collision, propagationPoint::kToVertex , matchingZ, mBz , mZShift );
787+ float eta = propmuonAtPV.getEta ();
788+ float phi = propmuonAtPV.getPhi ();
789+ o2::math_utils::bringTo02Pi (phi);
790+
791+ float deta = etaMatchedMCHMID - eta;
792+ float dphi = phiMatchedMCHMID - phi;
793+ o2::math_utils::bringToPMPi (dphi);
794+ float dr = std::sqrt (deta * deta + dphi * dphi);
779795
780796 // auto mcParticle_MFTMCHMID = muon_tmp.template mcParticle_as<aod::McParticles>(); // this is identical to mcParticle_MCHMID
781797 auto mcParticle_MCHMID = mchtrack.template mcParticle_as <aod::McParticles>(); // this is identical to mcParticle_MFTMCHMID
782798 auto mcParticle_MFT = mfttrack.template mcParticle_as <aod::McParticles>();
783799 // float chi2ndf = muon_tmp.chi2() / (2.f * (mchtrack.nClusters() + mfttrack.nClusters()) - 5.f);
784800
801+ bool isPrimary = mcParticle_MCHMID.isPhysicalPrimary () || mcParticle_MCHMID.producedByGenerator ();
802+ bool isMatched = (mcParticle_MFT.globalIndex () == mcParticle_MCHMID.globalIndex ()) && (mcParticle_MFT.mcCollisionId () == mcParticle_MCHMID.mcCollisionId ());
803+
804+ if (isPrimary) {
805+ if (isMatched) {
806+ fRegistry .fill (HIST (" MFTMCHMID/primary/correct/hdR_Chi2MatchMCHMFT" ), muon_tmp.chi2MatchMCHMFT (), dr);
807+ } else {
808+ fRegistry .fill (HIST (" MFTMCHMID/primary/wrong/hdR_Chi2MatchMCHMFT" ), muon_tmp.chi2MatchMCHMFT (), dr);
809+ }
810+ } else {
811+ if (isMatched) {
812+ fRegistry .fill (HIST (" MFTMCHMID/secondary/correct/hdR_Chi2MatchMCHMFT" ), muon_tmp.chi2MatchMCHMFT (), dr);
813+ } else {
814+ fRegistry .fill (HIST (" MFTMCHMID/secondary/wrong/hdR_Chi2MatchMCHMFT" ), muon_tmp.chi2MatchMCHMFT (), dr);
815+ }
816+ }
817+
785818 if (mcParticle_MFT.globalIndex () == mcParticle_MCHMID.globalIndex ()) {
786819 mapCorrectMatch[tupleId] = true ;
787820 } else {
0 commit comments