@@ -585,9 +585,9 @@ struct Chargedkstaranalysis {
585585 histosMc.add (" h3ChaKstarInvMassDSMcGen" , " h3ChaKstarInvMassDSMcGen" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
586586 histosMc.add (" h3ChaKstarInvMassDSMcRec" , " h3ChaKstarInvMassDSMcRec" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
587587 histosMc.add (" h3ChaKstarInvMassDSMcRecClosure" , " h3ChaKstarInvMassDSMcRecClosure" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
588+ histosMc.add (" sigLoss_den_pri_threeD" , " sigLoss_den_pri_threeD" , kTHnSparseF , {centAxis, ptAxis, thnAxisPOL}, true );
588589
589590 if (mcCfgs.doBkgMc ) {
590- histosMc.add (" h3ChaKstarInvMassRotMcGen" , " h3ChaKstarInvMassRotMcGen" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
591591 histosMc.add (" h3ChaKstarInvMassRotMcRec" , " h3ChaKstarInvMassRotMcRec" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
592592 histosMc.add (" h3ChaKstarInvMassRotMcRecClosure" , " h3ChaKstarInvMassRotMcRecClosure" , kTHnSparseF , {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true );
593593 }
@@ -604,8 +604,6 @@ struct Chargedkstaranalysis {
604604 histos.add (" Correction/sigLoss_num_pri" , " Gen primary Kstar (|y|<0.5, selected events) in reco class" , HistType::kTH2F , {ptAxis, centAxis});
605605 histos.add (" Correction/EF_den" , " Gen events (truth class)" , HistType::kTH1F , {centAxis});
606606 histos.add (" Correction/EF_num" , " Reco events (selected events)" , HistType::kTH1F , {centAxis});
607- histos.add (" sigLoss_den_pri_threeD" , " sigLoss_den_pri_threeD" , kTHnSparseF , {centAxis, ptAxis, thnAxisPOL}, true );
608- histos.add (" sigLoss_den_pri_threeD_rot" , " sigLoss_den_pri_threeD_rot" , kTHnSparseF , {centAxis, ptAxis, thnAxisPOL}, true );
609607 histos.add (" Correction/hNEventsMCTruth" , " hNEventsMCTruth" , HistType::kTH1F , {AxisSpec{nSteps, 0.5 , nSteps + 0.5 , " " }});
610608 auto hstep = histos.get <TH1 >(HIST (" Correction/hNEventsMCTruth" ));
611609 hstep->GetXaxis ()->SetBinLabel (1 , " All" );
@@ -849,18 +847,10 @@ struct Chargedkstaranalysis {
849847 if (currentIsGen) {
850848 if (sigLossDen) {
851849 // Fill ONLY the Signal Loss Denominator 3D Histograms
852- if (isRot) {
853- histos.fill (HIST (" sigLoss_den_pri_threeD_rot" ), multiplicity, mother.Pt (), cosTheta);
854- } else {
855- histos.fill (HIST (" sigLoss_den_pri_threeD" ), multiplicity, mother.Pt (), cosTheta);
856- }
850+ histosMc.fill (HIST (" sigLoss_den_pri_threeD" ), multiplicity, mother.Pt (), cosTheta);
857851 } else {
858852 // Fill standard 4D MC Gen Histograms
859- if (isRot) {
860- histosMc.fill (HIST (" h3ChaKstarInvMassRotMcGen" ), multiplicity, mother.Pt (), mother.M (), cosTheta);
861- } else {
862- histosMc.fill (HIST (" h3ChaKstarInvMassDSMcGen" ), multiplicity, mother.Pt (), mother.M (), cosTheta);
863- }
853+ histosMc.fill (HIST (" h3ChaKstarInvMassDSMcGen" ), multiplicity, mother.Pt (), mother.M (), cosTheta);
864854 }
865855 return ;
866856 }
@@ -926,7 +916,7 @@ struct Chargedkstaranalysis {
926916 auto phiCS = std::atan2 (yAxisCS.Dot (v1CM), xAxisCS.Dot (v1CM));
927917 phiCS = RecoDecay::constrainAngle (phiCS, 0.0 );
928918
929- bool doRotation = !doprocessMC || mcCfgs.doBkgMc ;
919+ bool doRotation = !doprocessMC || (!currentIsGen && mcCfgs.doBkgMc ) ;
930920 // if (std::abs(mother.Rapidity()) < config.rapidityMotherData) {
931921 if (helicityCfgs.activateHelicityFrame ) {
932922 // helicityVec = mother.Vect(); // 3 vector of mother in COM frame
@@ -1465,10 +1455,10 @@ struct Chargedkstaranalysis {
14651455 const float lCentrality = getCentrality (coll);
14661456 refCentByMcId.emplace (mcid, lCentrality);
14671457 }
1468-
1458+ currentIsGen = true ;
1459+ sigLossDen = false ;
14691460 // Calculating the generated Kstar
14701461 for (const auto & part : mcParticles) {
1471- currentIsGen = true ;
14721462 if (!part.has_mcCollision ()) {
14731463 continue ;
14741464 }
@@ -1559,9 +1549,102 @@ struct Chargedkstaranalysis {
15591549 }
15601550 }
15611551 }
1552+ sigLossDen = true ;
1553+ // To calculate the denominator -> To check the all the events have chk892
1554+ for (auto const & part : mcParticles) {
1555+ if (!part.has_mcCollision ()) {
1556+ continue ;
1557+ }
1558+ if (std::abs (part.pdgCode ()) != kKstarPlus ) {
1559+ continue ;
1560+ }
1561+ if (std::abs (part.y ()) > kstarCutCfgs.cKstarMaxRap ) {
1562+ continue ;
1563+ }
1564+
1565+ const auto mcid = part.mcCollisionId ();
1566+ if (!refClassIds.contains (mcid)) {
1567+ continue ;
1568+ }
1569+
1570+ auto iter = refCentByMcId.find (mcid);
1571+ if (iter == refCentByMcId.end ()) {
1572+ continue ;
1573+ }
1574+
1575+ const float lCentrality = iter->second ;
1576+
1577+ histos.fill (HIST (" Correction/sigLoss_den" ), part.pt (), lCentrality);
1578+ if (part.vt () == 0 ) {
1579+ histos.fill (HIST (" Correction/sigLoss_den_pri" ), part.pt (), lCentrality);
1580+ }
1581+ LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot;
1582+ lResoKstar = LorentzVectorSetXYZM (part.px (), part.py (), part.pz (), MassKPlusStar892);
1583+ const int pionWanted = (part.pdgCode () > 0 ) ? +kPiPlus : -kPiPlus ;
1584+ bool hasRightPion = false ;
1585+ bool hasK0sToPipi = false ;
1586+ for (const auto & d1 : part.template daughters_as <aod::McParticles>()) {
1587+ const int pdg1 = d1.pdgCode ();
1588+ if (pdg1 == pionWanted) {
1589+ lDecayDaughter_bach = LorentzVectorSetXYZM (d1.px (), d1.py (), d1.pz (), MassPionCharged);
1590+ if (helicityCfgs.genKinematicsChecks ) {
1591+ if (lDecayDaughter_bach.pt () <= trackCutCfgs.cMinPtcut || std::abs (lDecayDaughter_bach.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1592+ continue ;
1593+ }
1594+ }
1595+ hasRightPion = true ;
1596+ } else if (std::abs (pdg1) == kPDGK0 ) {
1597+ for (const auto & d2 : d1.template daughters_as <aod::McParticles>()) {
1598+ if (std::abs (d2.pdgCode ()) == kPDGK0s ) {
1599+ if (helicityCfgs.genKinematicsChecks ) {
1600+ if (d2.pt () <= secondaryCutsCfgs.cSecondaryPtMin || std::abs (d2.eta ()) >= secondaryCutsCfgs.cSecondaryRapidityMax ) {
1601+ continue ;
1602+ }
1603+ }
1604+ bool seenPip = false , seenPim = false ;
1605+ for (const auto & d3 : d2.template daughters_as <aod::McParticles>()) {
1606+ if (d3.pdgCode () == +kPiPlus ) {
1607+ if (helicityCfgs.genKinematicsChecks ) {
1608+ if (d3.pt () <= trackCutCfgs.cMinPtcut || std::abs (d3.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1609+ continue ;
1610+ }
1611+ }
1612+ seenPip = true ;
1613+ } else if (d3.pdgCode () == -kPiPlus ) {
1614+ if (helicityCfgs.genKinematicsChecks ) {
1615+ if (d3.pt () <= trackCutCfgs.cMinPtcut || std::abs (d3.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1616+ continue ;
1617+ }
1618+ }
1619+ seenPim = true ;
1620+ }
1621+ }
1622+ if (seenPip && seenPim) {
1623+ lResoSecondary = LorentzVectorSetXYZM (d2.px (), d2.py (), d2.pz (), MassK0Short);
1624+ hasK0sToPipi = true ;
1625+ break ;
1626+ }
1627+ }
1628+ }
1629+ }
1630+ if (hasRightPion && hasK0sToPipi) {
1631+ break ;
1632+ }
1633+ }
1634+
1635+ if (!(hasRightPion && hasK0sToPipi)) {
1636+ continue ;
1637+ }
1638+ if (helicityCfgs.cCosWithKShot ) {
1639+ fillInvMass (lResoKstar, lCentrality, lResoSecondary, lDecayDaughter_bach, eventCutCfgs.confIsMix );
1640+ } else {
1641+ fillInvMass (lResoKstar, lCentrality, lDecayDaughter_bach, lResoSecondary, eventCutCfgs.confIsMix );
1642+ }
1643+ }
1644+
1645+ currentIsGen = false ;
15621646 // To store the recoKstar
15631647 for (const auto & v0 : v0s) {
1564- currentIsGen = false ;
15651648 auto coll = v0.template collision_as <MCEventCandidates>();
15661649
15671650 if (!coll.has_mcCollision ()) {
@@ -1703,98 +1786,6 @@ struct Chargedkstaranalysis {
17031786 histos.fill (HIST (" Correction/sigLoss_num_pri" ), part.pt (), lCentrality);
17041787 }
17051788 }
1706- sigLossDen = true ;
1707- // To calculate the denominator -> To check the all the events have chk892
1708- for (auto const & part : mcParticles) {
1709- if (!part.has_mcCollision ()) {
1710- continue ;
1711- }
1712- if (std::abs (part.pdgCode ()) != kKstarPlus ) {
1713- continue ;
1714- }
1715- if (std::abs (part.y ()) > kstarCutCfgs.cKstarMaxRap ) {
1716- continue ;
1717- }
1718-
1719- const auto mcid = part.mcCollisionId ();
1720- if (!refClassIds.contains (mcid)) {
1721- continue ;
1722- }
1723-
1724- auto iter = refCentByMcId.find (mcid);
1725- if (iter == refCentByMcId.end ()) {
1726- continue ;
1727- }
1728-
1729- const float lCentrality = iter->second ;
1730-
1731- histos.fill (HIST (" Correction/sigLoss_den" ), part.pt (), lCentrality);
1732- if (part.vt () == 0 ) {
1733- histos.fill (HIST (" Correction/sigLoss_den_pri" ), part.pt (), lCentrality);
1734- }
1735- LorentzVectorSetXYZM lResoSecondary, lDecayDaughter_bach, lResoKstar, lDaughterRot;
1736- lResoKstar = LorentzVectorSetXYZM (part.px (), part.py (), part.pz (), MassKPlusStar892);
1737- const int pionWanted = (part.pdgCode () > 0 ) ? +kPiPlus : -kPiPlus ;
1738- bool hasRightPion = false ;
1739- bool hasK0sToPipi = false ;
1740- for (const auto & d1 : part.template daughters_as <aod::McParticles>()) {
1741- const int pdg1 = d1.pdgCode ();
1742- if (pdg1 == pionWanted) {
1743- lDecayDaughter_bach = LorentzVectorSetXYZM (d1.px (), d1.py (), d1.pz (), MassPionCharged);
1744- if (helicityCfgs.genKinematicsChecks ) {
1745- if (lDecayDaughter_bach.pt () <= trackCutCfgs.cMinPtcut || std::abs (lDecayDaughter_bach.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1746- continue ;
1747- }
1748- }
1749- hasRightPion = true ;
1750- } else if (std::abs (pdg1) == kPDGK0 ) {
1751- for (const auto & d2 : d1.template daughters_as <aod::McParticles>()) {
1752- if (std::abs (d2.pdgCode ()) == kPDGK0s ) {
1753- if (helicityCfgs.genKinematicsChecks ) {
1754- if (d2.pt () <= secondaryCutsCfgs.cSecondaryPtMin || std::abs (d2.eta ()) >= secondaryCutsCfgs.cSecondaryRapidityMax ) {
1755- continue ;
1756- }
1757- }
1758- bool seenPip = false , seenPim = false ;
1759- for (const auto & d3 : d2.template daughters_as <aod::McParticles>()) {
1760- if (d3.pdgCode () == +kPiPlus ) {
1761- if (helicityCfgs.genKinematicsChecks ) {
1762- if (d3.pt () <= trackCutCfgs.cMinPtcut || std::abs (d3.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1763- continue ;
1764- }
1765- }
1766- seenPip = true ;
1767- } else if (d3.pdgCode () == -kPiPlus ) {
1768- if (helicityCfgs.genKinematicsChecks ) {
1769- if (d3.pt () <= trackCutCfgs.cMinPtcut || std::abs (d3.eta ()) >= trackCutCfgs.cMaxEtacut ) {
1770- continue ;
1771- }
1772- }
1773- seenPim = true ;
1774- }
1775- }
1776- if (seenPip && seenPim) {
1777- lResoSecondary = LorentzVectorSetXYZM (d2.px (), d2.py (), d2.pz (), MassK0Short);
1778- hasK0sToPipi = true ;
1779- break ;
1780- }
1781- }
1782- }
1783- }
1784- if (hasRightPion && hasK0sToPipi) {
1785- break ;
1786- }
1787- }
1788-
1789- if (!(hasRightPion && hasK0sToPipi)) {
1790- continue ;
1791- }
1792- if (helicityCfgs.cCosWithKShot ) {
1793- fillInvMass (lResoKstar, lCentrality, lResoSecondary, lDecayDaughter_bach, eventCutCfgs.confIsMix );
1794- } else {
1795- fillInvMass (lResoKstar, lCentrality, lDecayDaughter_bach, lResoSecondary, eventCutCfgs.confIsMix );
1796- }
1797- }
17981789 // To calculate the event fraction correction
17991790 for (const auto & mcid : refClassIds) {
18001791 histos.fill (HIST (" Correction/EF_den" ), refCentByMcId[mcid]);
0 commit comments