Skip to content

Commit 4d7ca86

Browse files
First attempt to get generated sigma0s
1 parent d00e56b commit 4d7ca86

File tree

1 file changed

+108
-26
lines changed

1 file changed

+108
-26
lines changed

PWGLF/TableProducer/Strangeness/sigma0builder.cxx

Lines changed: 108 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ struct sigma0builder {
137137

138138
// For standard approach:
139139
//// Lambda criteria:
140-
Configurable<float> V0Rapidity{"V0Rapidity", 0.8, "v0 rapidity"};
140+
Configurable<float> V0Rapidity{"V0Rapidity", 0.5, "v0 rapidity"};
141141

142142
Configurable<float> LambdaDauPseudoRap{"LambdaDauPseudoRap", 1.5, "Max pseudorapidity of daughter tracks"};
143143
Configurable<float> LambdaMinDCANegToPv{"LambdaMinDCANegToPv", 0.0, "min DCA Neg To PV (cm)"};
@@ -366,15 +366,31 @@ struct sigma0builder {
366366
histos.add("Gen/hCentralityVsNcoll_beforeEvSel", "hCentralityVsNcoll_beforeEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}});
367367
histos.add("Gen/hCentralityVsNcoll_afterEvSel", "hCentralityVsNcoll_afterEvSel", kTH2F, {axisCentrality, {50, -0.5f, 49.5f}});
368368
histos.add("Gen/hCentralityVsMultMC", "hCentralityVsMultMC", kTH2F, {{101, 0.0f, 101.0f}, axisNch});
369+
370+
histos.add("Gen/hTestGeneratedSigma0s", "hTestGeneratedSigma0s", kTH1F, {axisPt});
371+
histos.add("Gen/hTestMCParticleSigma0", "hTestMCParticleSigma0", kTH1F, {axisPt});
372+
369373
histos.add("Gen/h2dGenGamma", "h2dGenGamma", kTH2D, {axisCentrality, axisPt});
370374
histos.add("Gen/h2dGenLambda", "h2dGenLambda", kTH2D, {axisCentrality, axisPt});
371375
histos.add("Gen/h2dGenAntiLambda", "h2dGenAntiLambda", kTH2D, {axisCentrality, axisPt});
376+
histos.add("Gen/h2dGenSigma0", "h2dGenSigma0", kTH2D, {axisCentrality, axisPt});
377+
histos.add("Gen/h2dGenAntiSigma0", "h2dGenAntiSigma0", kTH2D, {axisCentrality, axisPt});
378+
histos.add("Gen/h2dGenPi0", "h2dGenPi0", kTH2D, {axisCentrality, axisPt});
379+
372380
histos.add("Gen/h2dGenGammaVsMultMC_RecoedEvt", "h2dGenGammaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
373381
histos.add("Gen/h2dGenLambdaVsMultMC_RecoedEvt", "h2dGenLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
374382
histos.add("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt", "h2dGenAntiLambdaVsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
383+
histos.add("Gen/h2dGenSigma0VsMultMC_RecoedEvt", "h2dGenSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
384+
histos.add("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt", "h2dGenAntiSigma0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
385+
histos.add("Gen/h2dGenPi0VsMultMC_RecoedEvt", "h2dGenPi0VsMultMC_RecoedEvt", kTH2D, {axisNch, axisPt});
386+
375387
histos.add("Gen/h2dGenGammaVsMultMC", "h2dGenGammaVsMultMC", kTH2D, {axisNch, axisPt});
376388
histos.add("Gen/h2dGenLambdaVsMultMC", "h2dGenLambdaVsMultMC", kTH2D, {axisNch, axisPt});
377389
histos.add("Gen/h2dGenAntiLambdaVsMultMC", "h2dGenAntiLambdaVsMultMC", kTH2D, {axisNch, axisPt});
390+
histos.add("Gen/h2dGenSigma0VsMultMC", "h2dGenSigma0VsMultMC", kTH2D, {axisNch, axisPt});
391+
histos.add("Gen/h2dGenAntiSigma0VsMultMC", "h2dGenAntiSigma0VsMultMC", kTH2D, {axisNch, axisPt});
392+
histos.add("Gen/h2dGenPi0VsMultMC", "h2dGenPi0VsMultMC", kTH2D, {axisNch, axisPt});
393+
378394
histos.add("Gen/hEventPVzMC", "hEventPVzMC", kTH1F, {{100, -20.0f, +20.0f}});
379395
histos.add("Gen/hCentralityVsPVzMC", "hCentralityVsPVzMC", kTH2F, {{101, 0.0f, 101.0f}, {100, -20.0f, +20.0f}});
380396

@@ -664,12 +680,19 @@ struct sigma0builder {
664680

665681
// ______________________________________________________
666682
// Simulated processing (subscribes to MC information too)
667-
template <typename TMCCollisions, typename TV0MCs, typename TCollisions>
668-
void analyzeGeneratedV0s(TMCCollisions const& mcCollisions, TV0MCs const& V0MCCores, TCollisions const& collisions)
683+
template <typename TMCCollisions, typename TV0MCs, typename TCollisions, typename TMCParticles>
684+
void analyzeGeneratedV0s(TMCCollisions const& mcCollisions, TV0MCs const& V0MCCores, TCollisions const& collisions, TMCParticles const& mcParticles)
669685
{
686+
670687
fillGeneratedEventProperties(mcCollisions, collisions);
671688
std::vector<int> listBestCollisionIdx = getListOfRecoCollIndices(mcCollisions, collisions);
689+
672690
for (auto const& v0MC : V0MCCores) {
691+
692+
float testymc = v0MC.rapidityMC(1);//RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma);
693+
if (v0MC.pdgCode()==3122 && v0MC.pdgCodeMother()==3212 && TMath::Abs(testymc) <= 0.5)
694+
histos.fill(HIST("Gen/hTestGeneratedSigma0s"), v0MC.ptMC());
695+
673696
if (!v0MC.has_straMCCollision())
674697
continue;
675698

@@ -679,18 +702,9 @@ struct sigma0builder {
679702

680703
histos.fill(HIST("Gen/hPrimaryV0s"), 1);
681704

682-
// TODO: get generated sigma0s
683-
684-
float ptmc = v0MC.ptMC();
685-
float ymc = 1e3;
686-
if (v0MC.pdgCode() == 22)
687-
ymc = RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma);
688-
689-
else if (std::abs(v0MC.pdgCode()) == 3122)
690-
ymc = v0MC.rapidityMC(1);
691-
692-
if (std::abs(ymc) > V0Rapidity)
693-
continue;
705+
// float testymc = RecoDecay::y(std::array{v0MC.pxMC(), v0MC.pyMC(), v0MC.pzMC()}, o2::constants::physics::MassGamma);
706+
// if (v0MC.pdgCode()==22 && v0MC.pdgCodeMother()==3212 && TMath::Abs(testymc) <= 0.5)
707+
// histos.fill(HIST("Gen/hTestGeneratedSigma0s"), v0MC.ptMC());
694708

695709
auto mcCollision = v0MC.template straMCCollision_as<soa::Join<aod::StraMCCollisions, aod::StraMCCollMults>>();
696710
if (eventSelections.applyZVtxSelOnMCPV && std::abs(mcCollision.posZ()) > eventSelections.maxZVtxPosition) {
@@ -706,34 +720,102 @@ struct sigma0builder {
706720
}
707721
}
708722

723+
// Get corresponding MC particle entry for this MCV0
724+
auto mcParticle = mcParticles.rawIteratorAt(v0MC.particleIdMC());
725+
int motherIdx = mcParticle.mothersIds()[0];
726+
727+
// Get photon mother
728+
auto mcMother = mcParticles.iteratorAt(motherIdx);
729+
730+
// Calculating properties
731+
float ymc = mcParticle.y();
732+
float ymcmother = mcMother.y();
733+
float ptmc = mcParticle.pt();
734+
float ptmcmother = mcMother.pt();
735+
bool isV0Photon = mcParticle.pdgCode() == 22;
736+
bool isV0Lambda = mcParticle.pdgCode() == 3122;
737+
bool isV0AntiLambda = mcParticle.pdgCode() == -3122;
738+
bool isMotherSigma0 = mcMother.pdgCode() == 3212;
739+
bool isMotherAntiSigma0 = mcMother.pdgCode() == -3212;
740+
bool isMotherPi0 = mcMother.pdgCode() == 111;
741+
bool saveGenV0 = false;
742+
bool saveGenMother = false;
743+
744+
// Rapidity selection
745+
if (TMath::Abs(ymc) <= 0.5)
746+
saveGenV0 = true;
747+
748+
if (TMath::Abs(ymcmother) <= 0.5)
749+
saveGenMother = true;
750+
709751
float centrality = 100.5f;
710752
if (listBestCollisionIdx[mcCollision.globalIndex()] > -1) {
711753
auto collision = collisions.iteratorAt(listBestCollisionIdx[mcCollision.globalIndex()]);
712754
centrality = doPPAnalysis ? collision.centFT0M() : collision.centFT0C();
713755

714-
if (v0MC.pdgCode() == 22) {
715-
histos.fill(HIST("Gen/h2dGenGammaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
756+
if (isV0Photon) {
757+
if (saveGenV0)
758+
histos.fill(HIST("Gen/h2dGenGammaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
759+
760+
// Saving mothers info - please note we just need to do this for one v0 species to avoid double counting
761+
// Counting generated sigma0, anti-sigma0 and pi0s
762+
if (saveGenMother){
763+
if (isMotherSigma0)
764+
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmcmother);
765+
766+
if (isMotherAntiSigma0)
767+
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmcmother);
768+
769+
if (isMotherPi0)
770+
histos.fill(HIST("Gen/h2dGenPi0VsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmcmother);
771+
}
716772
}
717-
if (v0MC.pdgCode() == 3122) {
773+
if (saveGenV0 && isV0Lambda) {
718774
histos.fill(HIST("Gen/h2dGenLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
719775
}
720-
if (v0MC.pdgCode() == -3122) {
776+
if (saveGenV0 && isV0AntiLambda) {
721777
histos.fill(HIST("Gen/h2dGenAntiLambdaVsMultMC_RecoedEvt"), mcCollision.multMCNParticlesEta05(), ptmc);
722778
}
723779
}
724-
if (v0MC.pdgCode() == 22) {
725-
histos.fill(HIST("Gen/h2dGenGamma"), centrality, ptmc);
726-
histos.fill(HIST("Gen/h2dGenGammaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
780+
if (isV0Photon) {
781+
if (saveGenV0){
782+
histos.fill(HIST("Gen/h2dGenGamma"), centrality, ptmc);
783+
histos.fill(HIST("Gen/h2dGenGammaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
784+
}
785+
// Saving mothers info - please note we just need to do this for one v0 species to avoid double counting
786+
// Counting generated sigma0, anti-sigma0 and pi0s
787+
if (saveGenMother){
788+
if (isMotherSigma0){
789+
histos.fill(HIST("Gen/h2dGenSigma0"), centrality, ptmcmother);
790+
histos.fill(HIST("Gen/h2dGenSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmcmother);
791+
}
792+
if (isMotherAntiSigma0){
793+
histos.fill(HIST("Gen/h2dGenAntiSigma0"), centrality, ptmcmother);
794+
histos.fill(HIST("Gen/h2dGenAntiSigma0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmcmother);
795+
}
796+
if (isMotherPi0){
797+
histos.fill(HIST("Gen/h2dGenPi0"), centrality, ptmcmother);
798+
histos.fill(HIST("Gen/h2dGenPi0VsMultMC"), mcCollision.multMCNParticlesEta05(), ptmcmother);
799+
}
800+
}
727801
}
728-
if (v0MC.pdgCode() == 3122) {
802+
if (saveGenV0 && isV0Lambda) {
729803
histos.fill(HIST("Gen/h2dGenLambda"), centrality, ptmc);
730804
histos.fill(HIST("Gen/h2dGenLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
731805
}
732-
if (v0MC.pdgCode() == -3122) {
806+
if (saveGenV0 && isV0AntiLambda) {
733807
histos.fill(HIST("Gen/h2dGenAntiLambda"), centrality, ptmc);
734808
histos.fill(HIST("Gen/h2dGenAntiLambdaVsMultMC"), mcCollision.multMCNParticlesEta05(), ptmc);
735809
}
736810
}
811+
812+
for (auto& mcp : mcParticles) {
813+
if (TMath::Abs(mcp.y()) <= 0.5) {
814+
if (mcp.pdgCode() == 3212) {
815+
histos.fill(HIST("Gen/hTestMCParticleSigma0"), mcp.pt());
816+
}
817+
}
818+
}
737819
}
738820

739821
template <typename TV0Object, typename TCollision>
@@ -1407,9 +1489,9 @@ struct sigma0builder {
14071489
}
14081490

14091491
// Simulated processing in Run 3 (subscribes to MC information too)
1410-
void processGeneratedRun3(soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const& mcCollisions, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& V0MCCores, soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels> const& collisions)
1492+
void processGeneratedRun3(soa::Join<aod::StraMCCollisions, aod::StraMCCollMults> const& mcCollisions, soa::Join<aod::V0MCCores, aod::V0MCCollRefs> const& V0MCCores, soa::Join<aod::StraCollisions, aod::StraCents, aod::StraEvSels, aod::StraStamps, aod::StraCollLabels> const& collisions, aod::McParticles const& mcParticles)
14111493
{
1412-
analyzeGeneratedV0s(mcCollisions, V0MCCores, collisions);
1494+
analyzeGeneratedV0s(mcCollisions, V0MCCores, collisions, mcParticles);
14131495
}
14141496

14151497
PROCESS_SWITCH(sigma0builder, processMonteCarlo, "process as if MC data", false);

0 commit comments

Comments
 (0)