@@ -1864,128 +1864,131 @@ struct HfCandidateCreatorXic0XicpToHadronicMc {
18641864 {
18651865 auto particle = mcParticles.rawIteratorAt (indexRecXicPlus);
18661866 origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false );
1867- // Fill histograms
1868- if (flag != 0 && configs.fillMcHistograms )
1869- {
1870- registry.fill (HIST (" hDecayedPions" ), nPionsDecayed);
1871- registry.fill (HIST (" hInteractionsWithMaterial" ), nInteractionsWithMaterial);
1872- }
1873- // Fill table
1874- cursors.rowCandXicpMcRec (flag, origin);
1875- } // close loop over candidates
1867+ }
1868+
1869+ // Fill histograms
1870+ if (flag != 0 && configs.fillMcHistograms )
1871+ {
1872+ registry.fill (HIST (" hDecayedPions" ), nPionsDecayed);
1873+ registry.fill (HIST (" hInteractionsWithMaterial" ), nInteractionsWithMaterial);
1874+ }
1875+
1876+ // Fill table
1877+ cursors.rowCandXicpMcRec (flag, origin);
1878+ } // close loop over candidates
1879+
1880+ // Match generated particles.
1881+ for (const auto & mcCollision : mcCollisions)
1882+ {
1883+ // Slice the particles table to get the particles for the current MC collision
1884+ const auto mcParticlesPerMcColl = mcParticles.sliceBy (mcParticlesPerMcCollision, mcCollision.globalIndex ());
1885+ // Slice the collisions table to get the collision info for the current MC collision
1886+ float centrality{-1 .f };
1887+ uint16_t rejectionMask{0 };
1888+ int nSplitColl = 0 ;
1889+
1890+ if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C)
1891+ {
1892+ const auto collSlice = collInfos.sliceBy (colPerMcCollisionFT0C, mcCollision.globalIndex ());
1893+ rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1894+ }
1895+ else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M)
1896+ {
1897+ const auto collSlice = collInfos.sliceBy (colPerMcCollisionFT0M, mcCollision.globalIndex ());
1898+ nSplitColl = collSlice.size ();
1899+ rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1900+ }
1901+ else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::None)
1902+ {
1903+ const auto collSlice = collInfos.sliceBy (colPerMcCollision, mcCollision.globalIndex ());
1904+ rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1905+ }
1906+
1907+ hfEvSelMc.fillHistograms <centEstimator>(mcCollision, rejectionMask, nSplitColl);
18761908
1877- // Match generated particles.
1878- for (const auto & mcCollision : mcCollisions)
1909+ if (rejectionMask != 0 )
18791910 {
1880- // Slice the particles table to get the particles for the current MC collision
1881- const auto mcParticlesPerMcColl = mcParticles.sliceBy (mcParticlesPerMcCollision, mcCollision.globalIndex ());
1882- // Slice the collisions table to get the collision info for the current MC collision
1883- float centrality{-1 .f };
1884- uint16_t rejectionMask{0 };
1885- int nSplitColl = 0 ;
1886-
1887- if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0C)
1911+ // at least one event selection not satisfied --> reject all particles from this collision
1912+ for (unsigned int i = 0 ; i < mcParticlesPerMcColl.size (); ++i)
18881913 {
1889- const auto collSlice = collInfos.sliceBy (colPerMcCollisionFT0C, mcCollision.globalIndex ());
1890- rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1914+ cursors.rowCandXicpMcGen (-99 , -99 , -99 );
18911915 }
1892- else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::FT0M)
1893- {
1894- const auto collSlice = collInfos.sliceBy (colPerMcCollisionFT0M, mcCollision.globalIndex ());
1895- nSplitColl = collSlice.size ();
1896- rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1897- }
1898- else if constexpr (centEstimator == o2::hf_centrality::CentralityEstimator::None)
1899- {
1900- const auto collSlice = collInfos.sliceBy (colPerMcCollision, mcCollision.globalIndex ());
1901- rejectionMask = hfEvSelMc.getHfMcCollisionRejectionMask <BCsInfo, centEstimator>(mcCollision, collSlice, centrality);
1902- }
1903-
1904- hfEvSelMc.fillHistograms <centEstimator>(mcCollision, rejectionMask, nSplitColl);
1905-
1906- if (rejectionMask != 0 )
1916+ continue ;
1917+ }
1918+
1919+ for (const auto & particle : mcParticlesPerMcColl) {
1920+
1921+ sign = 0 ;
1922+ flag = 0 ;
1923+ origin = RecoDecay::OriginType::None;
1924+ arrDaughIndex.clear ();
1925+ idxBhadMothers.clear ();
1926+
1927+ // 4. Xic → Xi pi pi
1928+ if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, particle, Pdg::kXiCPlus , std::array{+kXiMinus , +kPiPlus , +kPiPlus }, true , &sign, 2 ))
19071929 {
1908- // at least one event selection not satisfied --> reject all particles from this collision
1909- for (unsigned int i = 0 ; i < mcParticlesPerMcColl.size (); ++i)
1930+ // 5. Xi- -> Lambda pi
1931+ auto cascMC = mcParticles.rawIteratorAt (particle.daughtersIds ().front ());
1932+ // 6. Find Xi- from Xi(1530) -> Xi pi in case of resonant decay
1933+ RecoDecay::getDaughters (particle, &arrDaughIndex, std::array{0 }, 1 );
1934+ if (arrDaughIndex.size () == NDaughtersResonant)
19101935 {
1911- cursors.rowCandXicpMcGen (-99 , -99 , -99 );
1936+ auto cascStarMC = mcParticles.rawIteratorAt (particle.daughtersIds ().front ());
1937+ if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, cascStarMC, +3324 , std::array{+kXiMinus , +kPiPlus }, true ))
1938+ {
1939+ cascMC = mcParticles.rawIteratorAt (cascStarMC.daughtersIds ().front ());
1940+ }
19121941 }
1913- continue ;
1914- }
1915-
1916- for (const auto & particle : mcParticlesPerMcColl) {
19171942
1918- sign = 0 ;
1919- flag = 0 ;
1920- origin = RecoDecay::OriginType::None;
1921- arrDaughIndex.clear ();
1922- idxBhadMothers.clear ();
1923-
1924- // 4. Xic → Xi pi pi
1925- if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, particle, Pdg::kXiCPlus , std::array{+kXiMinus , +kPiPlus , +kPiPlus }, true , &sign, 2 ))
1943+ if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, cascMC, +kXiMinus , std::array{+kLambda0 , +kPiMinus }, true ))
19261944 {
1927- // 5. Xi- -> Lambda pi
1928- auto cascMC = mcParticles.rawIteratorAt (particle.daughtersIds ().front ());
1929- // 6. Find Xi- from Xi(1530) -> Xi pi in case of resonant decay
1930- RecoDecay::getDaughters (particle, &arrDaughIndex, std::array{0 }, 1 );
1931- if (arrDaughIndex.size () == NDaughtersResonant)
1932- {
1933- auto cascStarMC = mcParticles.rawIteratorAt (particle.daughtersIds ().front ());
1934- if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, cascStarMC, +3324 , std::array{+kXiMinus , +kPiPlus }, true ))
1935- {
1936- cascMC = mcParticles.rawIteratorAt (cascStarMC.daughtersIds ().front ());
1937- }
1938- }
1939-
1940- if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, cascMC, +kXiMinus , std::array{+kLambda0 , +kPiMinus }, true ))
1945+ // 7. Lambda -> p pi
1946+ auto v0MC = mcParticles.rawIteratorAt (cascMC.daughtersIds ().front ());
1947+ if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, v0MC, +kLambda0 , std::array{+kProton , +kPiMinus }, true ))
19411948 {
1942- // 7. Lambda -> p pi
1943- auto v0MC = mcParticles.rawIteratorAt (cascMC.daughtersIds ().front ());
1944- if (RecoDecay::isMatchedMCGen<false , true >(mcParticles, v0MC, +kLambda0 , std::array{+kProton , +kPiMinus }, true ))
1949+ if (arrDaughIndex.size () == NDaughtersResonant)
19451950 {
1946- if (arrDaughIndex. size () == NDaughtersResonant)
1951+ for ( auto iProng = 0u ; iProng < NDaughtersResonant; ++iProng )
19471952 {
1948- for (auto iProng = 0u ; iProng < NDaughtersResonant; ++iProng)
1949- {
1950- auto daughI = mcParticles.rawIteratorAt (arrDaughIndex[iProng]);
1951- arrPDGDaugh[iProng] = std::abs (daughI.pdgCode ());
1952- }
1953-
1954- if ((arrPDGDaugh[0 ] == arrXiResonance[0 ] && arrPDGDaugh[1 ] == arrXiResonance[1 ]) || (arrPDGDaugh[0 ] == arrXiResonance[1 ] && arrPDGDaugh[1 ] == arrXiResonance[0 ])) {
1955- flag = sign * (1 << aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi);
1956- }
1953+ auto daughI = mcParticles.rawIteratorAt (arrDaughIndex[iProng]);
1954+ arrPDGDaugh[iProng] = std::abs (daughI.pdgCode ());
19571955 }
1958- else
1959- {
1960- flag = sign * (1 << aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi );
1956+
1957+ if ((arrPDGDaugh[ 0 ] == arrXiResonance[ 0 ] && arrPDGDaugh[ 1 ] == arrXiResonance[ 1 ]) || (arrPDGDaugh[ 0 ] == arrXiResonance[ 1 ] && arrPDGDaugh[ 1 ] == arrXiResonance[ 0 ])) {
1958+ flag = sign * (1 << aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiResPiToXiPiPi );
19611959 }
19621960 }
1961+ else
1962+ {
1963+ flag = sign * (1 << aod::hf_cand_xic_to_xi_pi_pi::DecayType::XicToXiPiPi);
1964+ }
19631965 }
19641966 }
1967+ }
19651968
1966- // 8. Check whether the charm baryon is non-prompt (from a b quark).
1967- if (flag != 0 )
1968- {
1969- origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
1970- }
1971-
1972- // Fill table
1973- if (origin == RecoDecay::OriginType::NonPrompt)
1974- {
1975- auto bHadMother = mcParticles.rawIteratorAt (idxBhadMothers[0 ]);
1976- cursors.rowCandXicpMcGen (flag, origin, bHadMother.pdgCode ());
1977- }
1978-
1979- else
1980- {
1981- cursors.rowCandXicpMcGen (flag, origin, 0 );
1982- }
1983-
1984- } // end for loop generated particles
1969+ // 8. Check whether the charm baryon is non-prompt (from a b quark).
1970+ if (flag != 0 )
1971+ {
1972+ origin = RecoDecay::getCharmHadronOrigin (mcParticles, particle, false , &idxBhadMothers);
1973+ }
1974+
1975+ // Fill table
1976+ if (origin == RecoDecay::OriginType::NonPrompt)
1977+ {
1978+ auto bHadMother = mcParticles.rawIteratorAt (idxBhadMothers[0 ]);
1979+ cursors.rowCandXicpMcGen (flag, origin, bHadMother.pdgCode ());
1980+ }
1981+
1982+ else
1983+ {
1984+ cursors.rowCandXicpMcGen (flag, origin, 0 );
1985+ }
19851986
1986- } // end for loop McCollisions
1987- }
1988- } // end of runXicpMc
1987+ } // end for loop generated particles
1988+
1989+ } // end for loop McCollisions
1990+
1991+ } // end of run function MC Xicp
19891992
19901993 // ////////////////////////////////
19911994 // / ///
0 commit comments