2525#include " Framework/ASoAHelpers.h"
2626#include " Common/DataModel/PIDResponse.h"
2727#include " Common/DataModel/TrackSelectionTables.h"
28+ #include " Common/DataModel/McCollisionExtra.h"
2829
2930#include " Common/DataModel/EventSelection.h"
3031#include " Common/DataModel/Centrality.h"
@@ -61,8 +62,10 @@ struct NucleiHistTask {
6162
6263 // MC
6364 HistogramRegistry MC_recon_reg{" MC_particles_reco" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
65+ HistogramRegistry MC_gen_reg{" MC_particles_gen" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
6466 HistogramRegistry MC_DCA{" MC_DCA" , {}, OutputObjHandlingPolicy::AnalysisObject, true , true };
65- OutputObj<TH1I> histPDG{TH1I (" PDG" , " PDG;PDG code" , 18 , 0.0 , 18 )};
67+ OutputObj<TH1I> histPDG_reco{TH1I (" PDG reconstructed" , " PDG;PDG code" , 18 , 0.0 , 18 )};
68+ OutputObj<TH1I> histPDG_gen{TH1I (" PDG generated" , " PDG;PDG code" , 18 , 0.0 , 18 )};
6669 OutputObj<TH1I> histTrackcuts_MC{TH1I (" histTrackcuts_MC" , " Entires;Track cut" , 18 , 0 , 18 )};
6770
6871 void init (o2::framework::InitContext&)
@@ -88,20 +91,34 @@ struct NucleiHistTask {
8891 histTrackcuts_data->GetXaxis ()->SetBinLabel (13 , " GoldenChi2 cut passed" );
8992
9093 // +++++++++++++++++++++ MC ++++++++++++++++++++++++
91- histPDG->GetXaxis ()->SetBinLabel (1 , " #pi^{+}" );
92- histPDG->GetXaxis ()->SetBinLabel (2 , " #pi^{-}" );
93- histPDG->GetXaxis ()->SetBinLabel (3 , " K^{+}" );
94- histPDG->GetXaxis ()->SetBinLabel (4 , " K^{-}" );
95- histPDG->GetXaxis ()->SetBinLabel (5 , " p" );
96- histPDG->GetXaxis ()->SetBinLabel (6 , " #bar{p}" );
97- histPDG->GetXaxis ()->SetBinLabel (7 , " d" );
98- histPDG->GetXaxis ()->SetBinLabel (8 , " #bar{d}" );
99- histPDG->GetXaxis ()->SetBinLabel (9 , " t" );
100- histPDG->GetXaxis ()->SetBinLabel (10 , " #bar{t}" );
101- histPDG->GetXaxis ()->SetBinLabel (11 , " ^{3}He" );
102- histPDG->GetXaxis ()->SetBinLabel (12 , " ^{3}#bar{He}" );
103- histPDG->GetXaxis ()->SetBinLabel (13 , " ^{4}He" );
104- histPDG->GetXaxis ()->SetBinLabel (14 , " ^{4}#bar{He}" );
94+ histPDG_reco->GetXaxis ()->SetBinLabel (1 , " #pi^{+}" );
95+ histPDG_reco->GetXaxis ()->SetBinLabel (2 , " #pi^{-}" );
96+ histPDG_reco->GetXaxis ()->SetBinLabel (3 , " K^{+}" );
97+ histPDG_reco->GetXaxis ()->SetBinLabel (4 , " K^{-}" );
98+ histPDG_reco->GetXaxis ()->SetBinLabel (5 , " p" );
99+ histPDG_reco->GetXaxis ()->SetBinLabel (6 , " #bar{p}" );
100+ histPDG_reco->GetXaxis ()->SetBinLabel (7 , " d" );
101+ histPDG_reco->GetXaxis ()->SetBinLabel (8 , " #bar{d}" );
102+ histPDG_reco->GetXaxis ()->SetBinLabel (9 , " t" );
103+ histPDG_reco->GetXaxis ()->SetBinLabel (10 , " #bar{t}" );
104+ histPDG_reco->GetXaxis ()->SetBinLabel (11 , " ^{3}He" );
105+ histPDG_reco->GetXaxis ()->SetBinLabel (12 , " ^{3}#bar{He}" );
106+ histPDG_reco->GetXaxis ()->SetBinLabel (13 , " ^{4}He" );
107+ histPDG_reco->GetXaxis ()->SetBinLabel (14 , " ^{4}#bar{He}" );
108+ histPDG_gen->GetXaxis ()->SetBinLabel (1 , " #pi^{+}" );
109+ histPDG_gen->GetXaxis ()->SetBinLabel (2 , " #pi^{-}" );
110+ histPDG_gen->GetXaxis ()->SetBinLabel (3 , " K^{+}" );
111+ histPDG_gen->GetXaxis ()->SetBinLabel (4 , " K^{-}" );
112+ histPDG_gen->GetXaxis ()->SetBinLabel (5 , " p" );
113+ histPDG_gen->GetXaxis ()->SetBinLabel (6 , " #bar{p}" );
114+ histPDG_gen->GetXaxis ()->SetBinLabel (7 , " d" );
115+ histPDG_gen->GetXaxis ()->SetBinLabel (8 , " #bar{d}" );
116+ histPDG_gen->GetXaxis ()->SetBinLabel (9 , " t" );
117+ histPDG_gen->GetXaxis ()->SetBinLabel (10 , " #bar{t}" );
118+ histPDG_gen->GetXaxis ()->SetBinLabel (11 , " ^{3}He" );
119+ histPDG_gen->GetXaxis ()->SetBinLabel (12 , " ^{3}#bar{He}" );
120+ histPDG_gen->GetXaxis ()->SetBinLabel (13 , " ^{4}He" );
121+ histPDG_gen->GetXaxis ()->SetBinLabel (14 , " ^{4}#bar{He}" );
105122 histTrackcuts_MC->GetXaxis ()->SetBinLabel (1 , " Events read" );
106123 histTrackcuts_MC->GetXaxis ()->SetBinLabel (2 , " Prim. particle. sel. passed" );
107124 histTrackcuts_MC->GetXaxis ()->SetBinLabel (3 , " Rap. cut passed" );
@@ -389,6 +406,12 @@ struct NucleiHistTask {
389406
390407 // +++++++++++++++++++++ MC ++++++++++++++++++++++++++
391408
409+ // MC generated
410+ MC_gen_reg.add (" histRecVtxMC" , " MC generated vertex z position" , HistType::kTH1F , {{400 , -40 ., +40 ., " z position (cm)" }});
411+ MC_gen_reg.add (" histCentrality" , " Centrality" , HistType::kTH1F , {centralityAxis});
412+ MC_gen_reg.add (" histEta" , " #eta" , HistType::kTH2F , {{102 , -2.01 , 2.01 }, PDGBINNING});
413+ MC_gen_reg.add (" histPt" , " p_{t}" , HistType::kTH2F , {ptAxis, PDGBINNING});
414+
392415 // MC reconstructed
393416 MC_recon_reg.add (" histRecVtxMC" , " MC reconstructed vertex z position" , HistType::kTH1F , {{400 , -40 ., +40 ., " z position (cm)" }});
394417 MC_recon_reg.add (" histCentrality" , " Centrality" , HistType::kTH1F , {centralityAxis});
@@ -475,6 +498,7 @@ struct NucleiHistTask {
475498 Configurable<bool > requireGoldenChi2{" requireGoldenChi2" , false , " Enable the requirement of GoldenChi2" };
476499 Configurable<bool > event_selection_sel8{" event_selection_sel8" , true , " Enable sel8 event selection" };
477500 Configurable<bool > event_selection_MC_sel8{" event_selection_MC_sel8" , true , " Enable sel8 event selection in MC processing" };
501+ Configurable<bool > require_PhysicalPrimary_MC_gen{" require_PhysicalPrimary_MC_gen" , true , " Enable PhysicalPrimary selection in generated MC processing" };
478502 Configurable<std::vector<float >> Tpc_mSigma_shift_Pi{" Tpc_mSigma_shift_Pi" , {.0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f }, " Array for shifting pi^{+} & pi^{-} nSigma values in TPC" };
479503 Configurable<std::vector<float >> Tpc_mSigma_shift_Pr{" Tpc_mSigma_shift_Pr" , {.0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f }, " Array for shifting (anti)proton nSigma values in TPC" };
480504 Configurable<std::vector<float >> Tpc_mSigma_shift_De{" Tpc_mSigma_shift_De" , {.0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f , .0f }, " Array for shifting (anti)deuteron nSigma values in TPC" };
@@ -1458,8 +1482,94 @@ struct NucleiHistTask {
14581482 }
14591483 PROCESS_SWITCH (NucleiHistTask, processDataCent, " process data with centralities" , false );
14601484
1461- void processMC (soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0Cs>::iterator const & collisions, soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::pidTPCLfFullPi, aod::pidTOFFullPi, aod::pidTPCLfFullKa, aod::pidTOFFullKa, aod::pidTPCLfFullPr, aod::pidTOFFullPr, aod::pidTPCLfFullDe, aod::pidTOFFullDe, aod::pidTPCLfFullTr, aod::pidTOFFullTr, aod::pidTPCLfFullHe, aod::pidTOFFullHe, aod::pidTPCLfFullAl, aod::pidTOFFullAl, aod::McTrackLabels, aod::TrackSelection, aod::TrackSelectionExtension, aod::TOFSignal, aod::pidTOFmass, aod::pidTOFbeta>> const & tracks,
1462- aod::McParticles& /* mcParticles*/ , aod::McCollisions const & /* mcCollisions*/ )
1485+ void processMCgen (aod::McCollision const & mcCollision, aod::McParticles const & mcParticles)
1486+ {
1487+ MC_gen_reg.fill (HIST (" histRecVtxMC" ), mcCollision.posZ ());
1488+ MC_gen_reg.fill (HIST (" histCentrality" ), mcCollision.impactParameter ());
1489+
1490+ for (const auto & mcParticleGen : mcParticles) {
1491+ if (require_PhysicalPrimary_MC_gen && !mcParticleGen.isPhysicalPrimary ())
1492+ continue ;
1493+ int pdgCode = mcParticleGen.pdgCode ();
1494+
1495+ if (mcParticleGen.y () > yMax || mcParticleGen.y () < yMin)
1496+ continue ;
1497+ if (mcParticleGen.eta () > cfgCutEta || mcParticleGen.eta () < -cfgCutEta)
1498+ continue ;
1499+
1500+ int pdgbin = 0 ;
1501+ switch (pdgCode) {
1502+ case +211 :
1503+ histPDG_gen->AddBinContent (1 );
1504+ pdgbin = 0 ;
1505+ break ;
1506+ case -211 :
1507+ histPDG_gen->AddBinContent (2 );
1508+ pdgbin = 1 ;
1509+ break ;
1510+ case +321 :
1511+ histPDG_gen->AddBinContent (3 );
1512+ pdgbin = 2 ;
1513+ break ;
1514+ case -321 :
1515+ histPDG_gen->AddBinContent (4 );
1516+ pdgbin = 3 ;
1517+ break ;
1518+ case +2212 :
1519+ histPDG_gen->AddBinContent (5 );
1520+ pdgbin = 4 ;
1521+ break ;
1522+ case -2212 :
1523+ histPDG_gen->AddBinContent (6 );
1524+ pdgbin = 5 ;
1525+ break ;
1526+ case +1000010020 :
1527+ histPDG_gen->AddBinContent (7 );
1528+ pdgbin = 6 ;
1529+ break ;
1530+ case -1000010020 :
1531+ histPDG_gen->AddBinContent (8 );
1532+ pdgbin = 7 ;
1533+ break ;
1534+ case +1000010030 :
1535+ histPDG_gen->AddBinContent (9 );
1536+ pdgbin = 8 ;
1537+ break ;
1538+ case -1000010030 :
1539+ histPDG_gen->AddBinContent (10 );
1540+ pdgbin = 9 ;
1541+ break ;
1542+ case +1000020030 :
1543+ histPDG_gen->AddBinContent (11 );
1544+ pdgbin = 10 ;
1545+ break ;
1546+ case -1000020030 :
1547+ histPDG_gen->AddBinContent (12 );
1548+ pdgbin = 11 ;
1549+ break ;
1550+ case +1000020040 :
1551+ histPDG_gen->AddBinContent (13 );
1552+ pdgbin = 12 ;
1553+ break ;
1554+ case -1000020040 :
1555+ histPDG_gen->AddBinContent (14 );
1556+ pdgbin = 13 ;
1557+ break ;
1558+ default :
1559+ break ;
1560+ }
1561+ MC_gen_reg.fill (HIST (" histEta" ), mcParticleGen.eta (), pdgbin);
1562+ if ((pdgCode == 1000020030 ) || (pdgCode == -1000020030 ) || (pdgCode == 1000020040 ) || (pdgCode == -1000020040 )) {
1563+ MC_gen_reg.fill (HIST (" histPt" ), mcParticleGen.pt () * 2.0 , pdgbin);
1564+ } else {
1565+ MC_gen_reg.fill (HIST (" histPt" ), mcParticleGen.pt (), pdgbin);
1566+ }
1567+ }
1568+ }
1569+ PROCESS_SWITCH (NucleiHistTask, processMCgen, " process generated MC" , false );
1570+
1571+ void processMCreco (soa::Join<aod::Collisions, aod::McCollisionLabels, aod::EvSels, aod::CentFT0Cs>::iterator const & collisions, soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::pidTPCLfFullPi, aod::pidTOFFullPi, aod::pidTPCLfFullKa, aod::pidTOFFullKa, aod::pidTPCLfFullPr, aod::pidTOFFullPr, aod::pidTPCLfFullDe, aod::pidTOFFullDe, aod::pidTPCLfFullTr, aod::pidTOFFullTr, aod::pidTPCLfFullHe, aod::pidTOFFullHe, aod::pidTPCLfFullAl, aod::pidTOFFullAl, aod::McTrackLabels, aod::TrackSelection, aod::TrackSelectionExtension, aod::TOFSignal, aod::pidTOFmass, aod::pidTOFbeta>> const & tracks,
1572+ aod::McParticles& /* mcParticles*/ , aod::McCollisions const & /* mcCollisions*/ )
14631573 {
14641574
14651575 if (event_selection_MC_sel8 && !collisions.sel8 ())
@@ -1552,46 +1662,46 @@ struct NucleiHistTask {
15521662
15531663 switch (particle.pdgCode ()) {
15541664 case +211 :
1555- histPDG ->AddBinContent (1 );
1665+ histPDG_reco ->AddBinContent (1 );
15561666 break ;
15571667 case -211 :
1558- histPDG ->AddBinContent (2 );
1668+ histPDG_reco ->AddBinContent (2 );
15591669 break ;
15601670 case +321 :
1561- histPDG ->AddBinContent (3 );
1671+ histPDG_reco ->AddBinContent (3 );
15621672 break ;
15631673 case -321 :
1564- histPDG ->AddBinContent (4 );
1674+ histPDG_reco ->AddBinContent (4 );
15651675 break ;
15661676 case +2212 :
1567- histPDG ->AddBinContent (5 );
1677+ histPDG_reco ->AddBinContent (5 );
15681678 break ;
15691679 case -2212 :
1570- histPDG ->AddBinContent (6 );
1680+ histPDG_reco ->AddBinContent (6 );
15711681 break ;
15721682 case +1000010020 :
1573- histPDG ->AddBinContent (7 );
1683+ histPDG_reco ->AddBinContent (7 );
15741684 break ;
15751685 case -1000010020 :
1576- histPDG ->AddBinContent (8 );
1686+ histPDG_reco ->AddBinContent (8 );
15771687 break ;
15781688 case +1000010030 :
1579- histPDG ->AddBinContent (9 );
1689+ histPDG_reco ->AddBinContent (9 );
15801690 break ;
15811691 case -1000010030 :
1582- histPDG ->AddBinContent (10 );
1692+ histPDG_reco ->AddBinContent (10 );
15831693 break ;
15841694 case +1000020030 :
1585- histPDG ->AddBinContent (11 );
1695+ histPDG_reco ->AddBinContent (11 );
15861696 break ;
15871697 case -1000020030 :
1588- histPDG ->AddBinContent (12 );
1698+ histPDG_reco ->AddBinContent (12 );
15891699 break ;
15901700 case +1000020040 :
1591- histPDG ->AddBinContent (13 );
1701+ histPDG_reco ->AddBinContent (13 );
15921702 break ;
15931703 case -1000020040 :
1594- histPDG ->AddBinContent (14 );
1704+ histPDG_reco ->AddBinContent (14 );
15951705 break ;
15961706 default :
15971707 break ;
@@ -1784,7 +1894,7 @@ struct NucleiHistTask {
17841894 }
17851895 }
17861896 }
1787- PROCESS_SWITCH (NucleiHistTask, processMC , " process MC" , false );
1897+ PROCESS_SWITCH (NucleiHistTask, processMCreco , " process reconstructed MC" , false );
17881898};
17891899
17901900// ****************************************************************************************************
0 commit comments