Skip to content

Commit 14a022c

Browse files
committed
Added the THnSparse for MC clousre
1 parent 5b21f91 commit 14a022c

1 file changed

Lines changed: 36 additions & 11 deletions

File tree

PWGLF/Tasks/Resonances/chargedkstaranalysis.cxx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ struct Chargedkstaranalysis {
9494
Preslice<aod::Tracks> perCollision = aod::track::collisionId;
9595
Preslice<aod::McParticles> perMCCollision = o2::aod::mcparticle::mcCollisionId;
9696
bool currentIsGen = false;
97+
bool mcClosure = false;
9798
struct : ConfigurableGroup {
9899
ConfigurableAxis cfgvtxbins{"cfgvtxbins", {VARIABLE_WIDTH, -10.0f, -8.f, -6.f, -4.f, -2.f, 0.f, 2.f, 4.f, 6.f, 8.f, 10.f}, "Mixing bins - z-vertex"};
99100
ConfigurableAxis cfgmultbins{"cfgmultbins", {VARIABLE_WIDTH, 0., 1., 5., 10., 30., 50., 70., 100., 110.}, "Mixing bins - multiplicity"};
@@ -226,6 +227,7 @@ struct Chargedkstaranalysis {
226227
// MC configurables
227228
struct : ConfigurableGroup {
228229
Configurable<bool> doBkgMc{"doBkgMc", false, "Apply rotation in MC"};
230+
Configurable<bool> doMcClosure{"doMcClosure", true, "Do MC Closure Study in MC"};
229231
} mcCfgs;
230232

231233
/// Track selections
@@ -300,7 +302,7 @@ struct Chargedkstaranalysis {
300302
} kstarCutCfgs;
301303

302304
Configurable<bool> isQaRequired{"isQaRequired", false, "Fill QA plots"};
303-
float centrality;
305+
float centrality = 0.f;
304306

305307
// PDG code
306308
int kPDGK0s = kK0Short;
@@ -562,9 +564,12 @@ struct Chargedkstaranalysis {
562564
if (!helicityCfgs.qAOptimisation) {
563565
histosMc.add("h3ChaKstarInvMassDSMcGen", "h3ChaKstarInvMassDSMcGen", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
564566
histosMc.add("h3ChaKstarInvMassDSMcRec", "h3ChaKstarInvMassDSMcRec", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
567+
histosMc.add("h3ChaKstarInvMassDSMcRecClosure", "h3ChaKstarInvMassDSMcRecClosure", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
568+
565569
if (mcCfgs.doBkgMc) {
566570
histosMc.add("h3ChaKstarInvMassRotMcGen", "h3ChaKstarInvMassRotMcGen", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
567571
histosMc.add("h3ChaKstarInvMassRotMcRec", "h3ChaKstarInvMassRotMcRec", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
572+
histosMc.add("h3ChaKstarInvMassRotMcRecClosure", "h3ChaKstarInvMassRotMcRecClosure", kTHnSparseF, {centAxis, ptAxis, invMassAxisReso, thnAxisPOL}, true);
568573
}
569574
}
570575

@@ -602,7 +607,7 @@ struct Chargedkstaranalysis {
602607
std::unordered_map<int64_t, float> centTruthByAllowed;
603608
std::unordered_set<int64_t> refClassIds;
604609
std::unordered_map<int64_t, float> refCentByMcId;
605-
float lMultiplicity;
610+
float lMultiplicity = 0.f;
606611
template <typename CollisionType>
607612
float getCentrality(CollisionType const& collision)
608613
{
@@ -775,24 +780,33 @@ struct Chargedkstaranalysis {
775780
void fillKstarHist(bool isRot, float multiplicity, const T& mother, double cosTheta)
776781
{
777782
if (!doprocessMC) {
778-
779783
if (isRot) {
780784
hChaKstar.fill(HIST("h3ChaKstarInvMassRot"), multiplicity, mother.Pt(), mother.M(), cosTheta);
781785
} else {
782786
hChaKstar.fill(HIST("h3ChaKstarInvMassDS"), multiplicity, mother.Pt(), mother.M(), cosTheta);
783787
}
788+
return;
789+
}
790+
791+
// MC Path
792+
if (currentIsGen) {
793+
if (isRot) {
794+
histosMc.fill(HIST("h3ChaKstarInvMassRotMcGen"), multiplicity, mother.Pt(), mother.M(), cosTheta);
795+
} else {
796+
histosMc.fill(HIST("h3ChaKstarInvMassDSMcGen"), multiplicity, mother.Pt(), mother.M(), cosTheta);
797+
}
784798
} else {
785-
if (currentIsGen) {
786-
if (isRot) {
787-
histosMc.fill(HIST("h3ChaKstarInvMassRotMcGen"), multiplicity, mother.Pt(), mother.M(), cosTheta);
799+
if (isRot) {
800+
if (!mcClosure) {
801+
histosMc.fill(HIST("h3ChaKstarInvMassRotMcRec"), multiplicity, mother.Pt(), mother.M(), cosTheta);
788802
} else {
789-
histosMc.fill(HIST("h3ChaKstarInvMassDSMcGen"), multiplicity, mother.Pt(), mother.M(), cosTheta);
803+
histosMc.fill(HIST("h3ChaKstarInvMassRotMcRecClosure"), multiplicity, mother.Pt(), mother.M(), cosTheta);
790804
}
791805
} else {
792-
if (isRot) {
793-
histosMc.fill(HIST("h3ChaKstarInvMassRotMcRec"), multiplicity, mother.Pt(), mother.M(), cosTheta);
794-
} else {
806+
if (!mcClosure) {
795807
histosMc.fill(HIST("h3ChaKstarInvMassDSMcRec"), multiplicity, mother.Pt(), mother.M(), cosTheta);
808+
} else {
809+
histosMc.fill(HIST("h3ChaKstarInvMassDSMcRecClosure"), multiplicity, mother.Pt(), mother.M(), cosTheta);
796810
}
797811
}
798812
}
@@ -844,7 +858,7 @@ struct Chargedkstaranalysis {
844858
auto phiCS = std::atan2(yAxisCS.Dot(v1CM), xAxisCS.Dot(v1CM));
845859
phiCS = RecoDecay::constrainAngle(phiCS, 0.0);
846860

847-
bool doRotation = (!doprocessMC) || (doprocessMC && mcCfgs.doBkgMc);
861+
bool doRotation = !doprocessMC || mcCfgs.doBkgMc;
848862
// if (std::abs(mother.Rapidity()) < config.rapidityMotherData) {
849863
if (helicityCfgs.activateHelicityFrame) {
850864
// helicityVec = mother.Vect(); // 3 vector of mother in COM frame
@@ -1466,6 +1480,17 @@ struct Chargedkstaranalysis {
14661480
const double yreco = lResoKstar.Rapidity();
14671481
if (std::abs(yreco) > kstarCutCfgs.cKstarMaxRap)
14681482
continue;
1483+
1484+
if (mcCfgs.doMcClosure) {
1485+
// For MC clousre test
1486+
mcClosure = true;
1487+
if (helicityCfgs.cCosWithKShot) {
1488+
fillInvMass(lResoKstar, lCentrality, lResoSecondary, lDecayDaughter_bach, eventCutCfgs.confIsMix);
1489+
} else {
1490+
fillInvMass(lResoKstar, lCentrality, lDecayDaughter_bach, lResoSecondary, eventCutCfgs.confIsMix);
1491+
}
1492+
}
1493+
mcClosure = false;
14691494
// Since we are doing the MC study and we know about the PDG code of each particle let's try to check the things which we have
14701495
if (!v0.has_mcParticle() || !bTrack.has_mcParticle())
14711496
continue;

0 commit comments

Comments
 (0)