5353#include < cmath>
5454#include < cstdlib>
5555#include < string>
56+ #include < unordered_map>
57+ #include < vector>
5658
5759using namespace o2 ;
5860using namespace o2 ::framework;
5961using namespace o2 ::framework::expressions;
6062
6163using std::array;
62- using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef, aod::SigmaMCLabels >;
64+ using MCSigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::Sigma0MCCores, aod::SigmaCollRef>;
6365using Sigma0s = soa::Join<aod::Sigma0Cores, aod::Sigma0PhotonExtras, aod::Sigma0LambdaExtras, aod::SigmaCollRef>;
6466
6567static const std::vector<std::string> PhotonSels = {" NoSel" , " V0Type" , " DCADauToPV" ,
@@ -124,7 +126,12 @@ struct sigmaanalysis {
124126 } eventSelections;
125127
126128 // Generated Sigma0s
127- Configurable<bool > mc_keepOnlyFromGenerator{" mc_keepOnlyFromGenerator" , true , " if true, consider only particles from generator to calculate efficiency." };
129+ struct : ConfigurableGroup {
130+ std::string prefix = " genSelections" ; // JSON group name
131+ Configurable<bool > mc_keepOnlyFromGenerator{" mc_keepOnlyFromGenerator" , true , " if true, consider only particles from generator to calculate efficiency." };
132+ Configurable<float > mc_rapidityMin{" mc_rapidityMin" , -0.5 , " Min generated particle rapidity" };
133+ Configurable<float > mc_rapidityMax{" mc_rapidityMax" , 0.5 , " Max generated particle rapidity" };
134+ } genSelections;
128135
129136 // QA
130137 Configurable<bool > fdoSigma0QA{" doSigma0QA" , false , " if true, perform Sigma0 QA analysis. Only works with MC." };
@@ -544,8 +551,8 @@ struct sigmaanalysis {
544551 histos.add (" Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt" , " h2dGenAntiSigma0VsMultMC_RecoedEvt" , kTH2D , {axisNch, axisPt});
545552 histos.add (" Gen/h2dGenSigma0VsMultMC" , " h2dGenSigma0VsMultMC" , kTH2D , {axisNch, axisPt});
546553 histos.add (" Gen/h2dGenAntiSigma0VsMultMC" , " h2dGenAntiSigma0VsMultMC" , kTH2D , {axisNch, axisPt});
547-
548- } else { // Pi0 specific
554+ }
555+ if (doprocessPi0GeneratedRun3) { // Pi0 specific
549556 histos.add (" Gen/h2dGenPi0VsMultMC_RecoedEvt" , " h2dGenPi0VsMultMC_RecoedEvt" , kTH2D , {axisNch, axisPt});
550557 histos.add (" Gen/h2dGenPi0" , " h2dGenPi0" , kTH2D , {axisCentrality, axisPt});
551558 histos.add (" Gen/h2dGenPi0VsMultMC" , " h2dGenPi0VsMultMC" , kTH2D , {axisNch, axisPt});
@@ -813,8 +820,12 @@ struct sigmaanalysis {
813820 continue ;
814821 }
815822
823+ // Rapidity selection
824+ if ((genParticle.mcy () < genSelections.mc_rapidityMin ) || (genParticle.mcy () > genSelections.mc_rapidityMax ))
825+ continue ;
826+
816827 // Selection on the source (generator/transport)
817- if (!genParticle.producedByGenerator () && mc_keepOnlyFromGenerator)
828+ if (!genParticle.producedByGenerator () && genSelections. mc_keepOnlyFromGenerator )
818829 continue ;
819830
820831 // Select corresponding mc collision && Basic event selection
@@ -834,33 +845,35 @@ struct sigmaanalysis {
834845
835846 // ______________________________________________________________________________
836847 // Generated Sigma0 processing
837- if constexpr (requires { genParticle.sigma0MCPt (); }) {
848+ if constexpr (requires { genParticle.isSigma0 (); }) {
849+ if (doprocessGeneratedRun3) {
838850
839- float ptmc = genParticle.sigma0MCPt ();
851+ float ptmc = genParticle.mcpt ();
840852
841- if (listBestCollisionIdx[mcCollision.globalIndex ()] > -1 ) {
842- auto collision = collisions.iteratorAt (listBestCollisionIdx[mcCollision.globalIndex ()]);
843- centrality = doPPAnalysis ? collision.centFT0M () : collision.centFT0C ();
853+ if (listBestCollisionIdx[mcCollision.globalIndex ()] > -1 ) {
854+ auto collision = collisions.iteratorAt (listBestCollisionIdx[mcCollision.globalIndex ()]);
855+ centrality = doPPAnalysis ? collision.centFT0M () : collision.centFT0C ();
844856
845- if (genParticle.isSigma0 ())
846- histos.fill (HIST (" Gen/h2dGenSigma0VsMultMC_RecoedEvt" ), mcCollision.multMCNParticlesEta05 (), ptmc);
857+ if (genParticle.isSigma0 ())
858+ histos.fill (HIST (" Gen/h2dGenSigma0VsMultMC_RecoedEvt" ), mcCollision.multMCNParticlesEta05 (), ptmc);
847859
848- else
849- histos.fill (HIST (" Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt" ), mcCollision.multMCNParticlesEta05 (), ptmc);
850- }
860+ else
861+ histos.fill (HIST (" Gen/h2dGenAntiSigma0VsMultMC_RecoedEvt" ), mcCollision.multMCNParticlesEta05 (), ptmc);
862+ }
851863
852- if (genParticle.isSigma0 ()) {
853- histos.fill (HIST (" Gen/h2dGenSigma0" ), centrality, ptmc);
854- histos.fill (HIST (" Gen/h2dGenSigma0VsMultMC" ), mcCollision.multMCNParticlesEta05 (), ptmc);
855- } else {
856- histos.fill (HIST (" Gen/h2dGenAntiSigma0" ), centrality, ptmc);
857- histos.fill (HIST (" Gen/h2dGenAntiSigma0VsMultMC" ), mcCollision.multMCNParticlesEta05 (), ptmc);
864+ if (genParticle.isSigma0 ()) {
865+ histos.fill (HIST (" Gen/h2dGenSigma0" ), centrality, ptmc);
866+ histos.fill (HIST (" Gen/h2dGenSigma0VsMultMC" ), mcCollision.multMCNParticlesEta05 (), ptmc);
867+ } else {
868+ histos.fill (HIST (" Gen/h2dGenAntiSigma0" ), centrality, ptmc);
869+ histos.fill (HIST (" Gen/h2dGenAntiSigma0VsMultMC" ), mcCollision.multMCNParticlesEta05 (), ptmc);
870+ }
858871 }
859872 }
860873 // ______________________________________________________________________________
861874 // Generated Pi0 processing
862- if constexpr ( requires { genParticle. pi0MCPt (); } ) {
863- float ptmc = genParticle.pi0MCPt ();
875+ if (doprocessPi0GeneratedRun3 ) {
876+ float ptmc = genParticle.mcpt ();
864877
865878 if (listBestCollisionIdx[mcCollision.globalIndex ()] > -1 ) {
866879 auto collision = collisions.iteratorAt (listBestCollisionIdx[mcCollision.globalIndex ()]);
@@ -1210,15 +1223,15 @@ struct sigmaanalysis {
12101223 " TPCTOFPID" , " DCADauToPV" , " Mass" };
12111224
12121225 if (PDGRequired == 22 ) {
1213- if constexpr (selection_index >= 0 && selection_index < ( int ) std::size (PhotonSelsLocal)) {
1226+ if constexpr (selection_index >= 0 && selection_index < static_cast < int >( std::size (PhotonSelsLocal) )) {
12141227 histos.fill (HIST (" Selection/Photon/hCandidateSel" ), selection_index);
12151228 histos.fill (HIST (" Selection/Photon/h2d" ) + HIST (PhotonSelsLocal[selection_index]), sigma.photonPt (), sigma.photonMass ());
12161229 histos.fill (HIST (" Selection/Sigma0/h2dPhoton" ) + HIST (PhotonSelsLocal[selection_index]), sigma.pt (), sigma.sigma0Mass ());
12171230 }
12181231 }
12191232
12201233 if (PDGRequired == 3122 ) {
1221- if constexpr (selection_index >= 0 && selection_index < ( int ) std::size (LambdaSelsLocal)) {
1234+ if constexpr (selection_index >= 0 && selection_index < static_cast < int >( std::size (LambdaSelsLocal) )) {
12221235 histos.fill (HIST (" Selection/Lambda/hCandidateSel" ), selection_index);
12231236 histos.fill (HIST (" Selection/Lambda/h2d" ) + HIST (LambdaSelsLocal[selection_index]), sigma.lambdaPt (), sigma.lambdaMass ());
12241237 histos.fill (HIST (" Selection/Sigma0/h2dLambda" ) + HIST (LambdaSelsLocal[selection_index]), sigma.pt (), sigma.sigma0Mass ());
@@ -1252,9 +1265,8 @@ struct sigmaanalysis {
12521265 auto sigma0mc = fullSigma0s.rawIteratorAt (sigma0Index[mcid]);
12531266 histos.fill (HIST (" Sigma0QA/hDuplicates" ), NDuplicates); // how many times a mc sigma0 was reconstructed
12541267
1255- if (sigma0mc.isSigma0 ()) {
1256- }
1257- histos.fill (HIST (" Sigma0QA/hSigma0Duplicates" ), NDuplicates); // how many times a mc sigma0 was reconstructed
1268+ if (sigma0mc.isSigma0 ())
1269+ histos.fill (HIST (" Sigma0QA/hSigma0Duplicates" ), NDuplicates); // how many times a mc sigma0 was reconstructed
12581270
12591271 if (sigma0mc.isAntiSigma0 ())
12601272 histos.fill (HIST (" Sigma0QA/hASigma0Duplicates" ), NDuplicates); // how many times a mc sigma0 was reconstructed
0 commit comments