Skip to content

Commit 63af69a

Browse files
[PWGCF] Added process MC generated (#16074)
1 parent 440d6b1 commit 63af69a

1 file changed

Lines changed: 127 additions & 10 deletions

File tree

PWGCF/EbyEFluctuations/Tasks/v0ptHadPiKaProt.cxx

Lines changed: 127 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct V0ptHadPiKaProt {
166166
TF1* fPtDepDCAz = nullptr;
167167

168168
O2_DEFINE_CONFIGURABLE(cfgUseSmallIonAdditionalEventCut, bool, true, "Use additional event cut on mult correlations for small ions")
169+
O2_DEFINE_CONFIGURABLE(cfgUseSmallIonAdditionalEventCutInMC, bool, false, "Use additional event cut on mult correlations for small ions while using MC generated")
169170
O2_DEFINE_CONFIGURABLE(cfgEvSelMultCorrelation, bool, true, "Multiplicity correlation cut")
170171
O2_DEFINE_CONFIGURABLE(cfgEvSelV0AT0ACut, bool, true, "V0A T0A 5 sigma cut")
171172
struct : ConfigurableGroup {
@@ -229,6 +230,9 @@ struct V0ptHadPiKaProt {
229230

230231
using MyMCRecCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::Mults, aod::McCollisionLabels>>;
231232
using MyMCTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::McTrackLabels, aod::pidTPCFullPr, aod::pidTOFFullPr, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTPCFullEl, aod::pidTOFFullEl>>;
233+
using EventCandidatesMC = soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::CentFT0Cs, aod::CentFT0Ms, aod::CentFT0As, aod::CentFV0As, aod::Mults>;
234+
235+
Preslice<MyMCTracks> perCollision = aod::track::collisionId;
232236
Preslice<aod::McParticles> perMcCollision = aod::mcparticle::mcCollisionId;
233237

234238
std::array<float, 6> tofNsigmaCut;
@@ -357,9 +361,9 @@ struct V0ptHadPiKaProt {
357361
histos.add("h2DnsigmaPionTofVsPtAfterCut", "2D hist of nSigmaTOF vs. pT (pion)", kTH2F, {ptAxis, nSigmaAxis});
358362
histos.add("h2DnsigmaKaonTofVsPtAfterCut", "2D hist of nSigmaTOF vs. pT (kaon)", kTH2F, {ptAxis, nSigmaAxis});
359363
histos.add("h2DnsigmaProtonTofVsPtAfterCut", "2D hist of nSigmaTOF vs. pT (proton)", kTH2F, {ptAxis, nSigmaAxis});
360-
histos.add("h2DnsigmaPionTpcVsTofAfterCut", "2D hist of nSigmaTPC vs. nSigmaTOF (pion)", kTH2F, {nSigmaAxis, nSigmaAxis});
361-
histos.add("h2DnsigmaKaonTpcVsTofAfterCut", "2D hist of nSigmaTPC vs. nSigmaTOF (kaon)", kTH2F, {nSigmaAxis, nSigmaAxis});
362-
histos.add("h2DnsigmaProtonTpcVsTofAfterCut", "2D hist of nSigmaTPC vs. nSigmaTOF (proton)", kTH2F, {nSigmaAxis, nSigmaAxis});
364+
histos.add("h2DnsigmaPionTpcVsTofAfterCut", "3D hist of nSigmaTPC vs. nSigmaTOF (pion)", kTH3F, {ptAxis, nSigmaAxis, nSigmaAxis});
365+
histos.add("h2DnsigmaKaonTpcVsTofAfterCut", "3D hist of nSigmaTPC vs. nSigmaTOF (kaon)", kTH3F, {ptAxis, nSigmaAxis, nSigmaAxis});
366+
histos.add("h2DnsigmaProtonTpcVsTofAfterCut", "3D hist of nSigmaTPC vs. nSigmaTOF (proton)", kTH3F, {ptAxis, nSigmaAxis, nSigmaAxis});
363367

364368
// Analysis profiles
365369

@@ -403,6 +407,12 @@ struct V0ptHadPiKaProt {
403407
histos.add("Prof_XY_weighted", "", {HistType::kTProfile2D, {centAxis, noAxis}});
404408
histos.add("Prof_XYZ_weighted_had", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
405409
histos.add("Prof_Z_weighted_had", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
410+
histos.add("Prof_XYZ_weighted_pi", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
411+
histos.add("Prof_Z_weighted_pi", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
412+
histos.add("Prof_XYZ_weighted_ka", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
413+
histos.add("Prof_Z_weighted_ka", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
414+
histos.add("Prof_XYZ_weighted_prot", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
415+
histos.add("Prof_Z_weighted_prot", "", {HistType::kTProfile2D, {centAxis, ptAxis}});
406416
}
407417

408418
// initial array
@@ -503,6 +513,10 @@ struct V0ptHadPiKaProt {
503513
histos.add("MCGenerated/hPtEtaPhiPion", "MC charged pions' pt, eta, phi", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
504514
histos.add("MCGenerated/hPtEtaPhiKaon", "MC charged kaons' pt, eta, phi", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
505515
histos.add("MCGenerated/hPtEtaPhiProton", "MC charged protons' pt, eta, phi", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
516+
histos.add("MCGenerated/hPtEtaPhiCharged_gen", "MC charged particles' pt, eta, phi in the generated process", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
517+
histos.add("MCGenerated/hPtEtaPhiPion_gen", "MC charged pions' pt, eta, phi in the generated process", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
518+
histos.add("MCGenerated/hPtEtaPhiKaon_gen", "MC charged kaons' pt, eta, phi in the generated process", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
519+
histos.add("MCGenerated/hPtEtaPhiProton_gen", "MC charged protons' pt, eta, phi in the generated process", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
506520

507521
histos.add("MCReconstructed/hPtEtaPhiChargedParticle", "MC reconstructed charged particles' pt, eta, phi", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
508522
histos.add("MCReconstructed/hPtEtaPhiChargedTrack", "MC reconstructed charged tracks' pt, eta, phi", kTH3D, {ptAxis, {100, 0., o2::constants::math::TwoPI}, {100, -2.01, 2.01}});
@@ -927,6 +941,109 @@ struct V0ptHadPiKaProt {
927941
return ptweight;
928942
}
929943

944+
void processMCGen(aod::McCollision const& mcCollision, aod::McParticles const& mcParticles, const soa::SmallGroups<EventCandidatesMC>& collisions, MyMCTracks const& tracks)
945+
{
946+
histos.fill(HIST("MCGenerated/hMC"), 0.5);
947+
if (std::abs(mcCollision.posZ()) < cfgCutVertex) {
948+
histos.fill(HIST("MCGenerated/hMC"), 1.5);
949+
}
950+
auto cent = 0;
951+
952+
int nchInel = 0;
953+
for (const auto& mcParticle : mcParticles) {
954+
auto pdgcode = std::abs(mcParticle.pdgCode());
955+
if (mcParticle.isPhysicalPrimary() && (pdgcode == PDG_t::kPiPlus || pdgcode == PDG_t::kKPlus || pdgcode == PDG_t::kProton || pdgcode == PDG_t::kElectron || pdgcode == PDG_t::kMuonMinus)) {
956+
if (std::abs(mcParticle.eta()) < 1.0) {
957+
nchInel = nchInel + 1;
958+
}
959+
}
960+
}
961+
if (nchInel > 0 && std::abs(mcCollision.posZ()) < cfgCutVertex)
962+
histos.fill(HIST("MCGenerated/hMC"), 2.5);
963+
std::vector<int64_t> selectedEvents(collisions.size());
964+
int nevts = 0;
965+
966+
for (const auto& collision : collisions) {
967+
if (!collision.sel8() || std::abs(collision.mcCollision().posZ()) > cfgCutVertex) {
968+
continue;
969+
}
970+
if (cfgUseGoodITSLayerAllCut && !(collision.selection_bit(o2::aod::evsel::kIsGoodITSLayersAll))) {
971+
continue;
972+
}
973+
if (cfgEvSelkNoSameBunchPileup && !(collision.selection_bit(o2::aod::evsel::kNoSameBunchPileup))) {
974+
continue;
975+
}
976+
if (cfgEvSelkNoITSROFrameBorder && !(collision.selection_bit(o2::aod::evsel::kNoITSROFrameBorder))) {
977+
continue;
978+
}
979+
if (cfgEvSelkNoTimeFrameBorder && !(collision.selection_bit(o2::aod::evsel::kNoTimeFrameBorder))) {
980+
continue;
981+
}
982+
if (cfgEvSelUseGoodZvtxFT0vsPV && !(collision.selection_bit(o2::aod::evsel::kIsGoodZvtxFT0vsPV))) {
983+
continue;
984+
}
985+
986+
// events with selection bits based on occupancy time pattern
987+
if (cfgEvSelUseOcuppancyTimeCut && !(collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) {
988+
continue;
989+
}
990+
991+
int occupancy = collision.trackOccupancyInTimeRange();
992+
if (cfgEvSelSetOcuppancyRange && (occupancy < cfgMinOccupancy || occupancy > cfgMaxOccupancy)) {
993+
continue;
994+
}
995+
996+
auto rectrackspart = tracks.sliceBy(perCollision, collision.globalIndex());
997+
cent = collision.centFT0C();
998+
if (cfgUseSmallIonAdditionalEventCutInMC && !eventSelectedSmallion(collision, rectrackspart.size(), cent)) {
999+
continue;
1000+
}
1001+
1002+
selectedEvents[nevts++] = collision.mcCollision_as<aod::McCollisions>().globalIndex();
1003+
}
1004+
selectedEvents.resize(nevts);
1005+
const auto evtReconstructedAndSelected = std::find(selectedEvents.begin(), selectedEvents.end(), mcCollision.globalIndex()) != selectedEvents.end();
1006+
histos.fill(HIST("MCGenerated/hMC"), 3.5);
1007+
if (!evtReconstructedAndSelected) { // Check that the event is reconstructed and that the reconstructed events pass the selection
1008+
return;
1009+
}
1010+
histos.fill(HIST("MCGenerated/hMC"), 4.5);
1011+
histos.fill(HIST("MCGenerated/hCentgen"), cent);
1012+
1013+
// creating phi, pt, eta dstribution of generted MC particles
1014+
1015+
// Generated track variables
1016+
for (const auto& mcParticle : mcParticles) {
1017+
if (!mcParticle.has_mcCollision())
1018+
continue;
1019+
1020+
// charged check
1021+
auto pdgEntry = TDatabasePDG::Instance()->GetParticle(mcParticle.pdgCode());
1022+
if (!pdgEntry)
1023+
continue;
1024+
if (pdgEntry->Charge() == 0)
1025+
continue;
1026+
1027+
if (mcParticle.isPhysicalPrimary()) {
1028+
if ((mcParticle.pt() > cfgCutPtLower) && (mcParticle.pt() < cfgCutPtUpper) && (std::abs(mcParticle.eta()) < cfgCutEta)) {
1029+
histos.fill(HIST("MCGenerated/hPtEtaPhiCharged_gen"), mcParticle.pt(), mcParticle.eta(), mcParticle.phi());
1030+
1031+
auto pdgcode = std::abs(mcParticle.pdgCode());
1032+
1033+
if (pdgcode == PDG_t::kPiPlus)
1034+
histos.fill(HIST("MCGenerated/hPtEtaPhiPion_gen"), mcParticle.pt(), mcParticle.eta(), mcParticle.phi());
1035+
1036+
if (pdgcode == PDG_t::kKPlus)
1037+
histos.fill(HIST("MCGenerated/hPtEtaPhiKaon_gen"), mcParticle.pt(), mcParticle.eta(), mcParticle.phi());
1038+
1039+
if (pdgcode == PDG_t::kProton)
1040+
histos.fill(HIST("MCGenerated/hPtEtaPhiProton_gen"), mcParticle.pt(), mcParticle.eta(), mcParticle.phi());
1041+
}
1042+
}
1043+
} //! end particle loop
1044+
}
1045+
PROCESS_SWITCH(V0ptHadPiKaProt, processMCGen, "Process Monte-carlo generated data", false);
1046+
9301047
// process MC recosnstructed data
9311048
void processMCRec(MyMCRecCollisions::iterator const& collision, MyMCTracks const& tracks, aod::McCollisions const&, aod::McParticles const& mcParticles)
9321049
{
@@ -1082,17 +1199,17 @@ struct V0ptHadPiKaProt {
10821199
if (isPion) {
10831200
histos.fill(HIST("h2DnsigmaPionTpcVsPtAfterCut"), track.pt(), nSigmaTpcPi);
10841201
histos.fill(HIST("h2DnsigmaPionTofVsPtAfterCut"), track.pt(), nSigmaTofPi);
1085-
histos.fill(HIST("h2DnsigmaPionTpcVsTofAfterCut"), nSigmaTpcPi, nSigmaTofPi);
1202+
histos.fill(HIST("h2DnsigmaPionTpcVsTofAfterCut"), track.pt(), nSigmaTpcPi, nSigmaTofPi);
10861203
}
10871204
if (isKaon) {
10881205
histos.fill(HIST("h2DnsigmaKaonTpcVsPtAfterCut"), track.pt(), nSigmaTpcKa);
10891206
histos.fill(HIST("h2DnsigmaKaonTofVsPtAfterCut"), track.pt(), nSigmaTofKa);
1090-
histos.fill(HIST("h2DnsigmaKaonTpcVsTofAfterCut"), nSigmaTpcKa, nSigmaTofKa);
1207+
histos.fill(HIST("h2DnsigmaKaonTpcVsTofAfterCut"), track.pt(), nSigmaTpcKa, nSigmaTofKa);
10911208
}
10921209
if (isProton) {
10931210
histos.fill(HIST("h2DnsigmaProtonTpcVsPtAfterCut"), track.pt(), nSigmaTpcProt);
10941211
histos.fill(HIST("h2DnsigmaProtonTofVsPtAfterCut"), track.pt(), nSigmaTofProt);
1095-
histos.fill(HIST("h2DnsigmaProtonTpcVsTofAfterCut"), nSigmaTpcProt, nSigmaTofProt);
1212+
histos.fill(HIST("h2DnsigmaProtonTpcVsTofAfterCut"), track.pt(), nSigmaTpcProt, nSigmaTofProt);
10961213
}
10971214

10981215
auto pdgcodeRec = std::abs(particle.pdgCode());
@@ -1121,7 +1238,7 @@ struct V0ptHadPiKaProt {
11211238
}
11221239
} // end track loop
11231240
}
1124-
PROCESS_SWITCH(V0ptHadPiKaProt, processMCRec, "Process Monte-carlo data", false);
1241+
PROCESS_SWITCH(V0ptHadPiKaProt, processMCRec, "Process Monte-carlo reconstructed data", false);
11251242

11261243
// process Data
11271244
void processData(AodCollisions::iterator const& coll, aod::BCsWithTimestamps const&, AodTracks const& inputTracks)
@@ -1301,17 +1418,17 @@ struct V0ptHadPiKaProt {
13011418
if (isPion) {
13021419
histos.fill(HIST("h2DnsigmaPionTpcVsPtAfterCut"), trkPt, nSigmaTpcPi);
13031420
histos.fill(HIST("h2DnsigmaPionTofVsPtAfterCut"), trkPt, nSigmaTofPi);
1304-
histos.fill(HIST("h2DnsigmaPionTpcVsTofAfterCut"), nSigmaTpcPi, nSigmaTofPi);
1421+
histos.fill(HIST("h2DnsigmaPionTpcVsTofAfterCut"), trkPt, nSigmaTpcPi, nSigmaTofPi);
13051422
}
13061423
if (isKaon) {
13071424
histos.fill(HIST("h2DnsigmaKaonTpcVsPtAfterCut"), trkPt, nSigmaTpcKa);
13081425
histos.fill(HIST("h2DnsigmaKaonTofVsPtAfterCut"), trkPt, nSigmaTofKa);
1309-
histos.fill(HIST("h2DnsigmaKaonTpcVsTofAfterCut"), nSigmaTpcKa, nSigmaTofKa);
1426+
histos.fill(HIST("h2DnsigmaKaonTpcVsTofAfterCut"), trkPt, nSigmaTpcKa, nSigmaTofKa);
13101427
}
13111428
if (isProton) {
13121429
histos.fill(HIST("h2DnsigmaProtonTpcVsPtAfterCut"), trkPt, nSigmaTpcProt);
13131430
histos.fill(HIST("h2DnsigmaProtonTofVsPtAfterCut"), trkPt, nSigmaTofProt);
1314-
histos.fill(HIST("h2DnsigmaProtonTpcVsTofAfterCut"), nSigmaTpcProt, nSigmaTofProt);
1431+
histos.fill(HIST("h2DnsigmaProtonTpcVsTofAfterCut"), trkPt, nSigmaTpcProt, nSigmaTofProt);
13151432
}
13161433

13171434
if (track.sign() != 0) {

0 commit comments

Comments
 (0)