Skip to content

Commit 59b308c

Browse files
author
nkaratze
committed
Added derived process for Data and MC-Reco
1 parent d20cdae commit 59b308c

File tree

1 file changed

+234
-4
lines changed

1 file changed

+234
-4
lines changed

PWGLF/Tasks/Strangeness/v0ptinvmassplots.cxx

Lines changed: 234 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ struct V0PtInvMassPlots {
679679

680680
void genMCProcess(
681681
soa::Join<aod::McCollisions, aod::McCentFT0Ms>::iterator const& mcCollision,
682-
soa::SmallGroups<soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::PVMults>> const& collisions,
682+
soa::SmallGroups<soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::PVMults, aod::CentFT0Ms>> const& collisions,
683683
aod::McParticles const& mcParticles)
684684
{
685685
// Event Efficiency, Event Split and V0 Signal Loss Corrections
@@ -927,7 +927,7 @@ struct V0PtInvMassPlots {
927927
}
928928
}
929929
// This is the process for Real Data
930-
void dataProcess(soa::Join<aod::Collisions, aod::EvSels, aod::PVMults, aod::CentFT0Ms /*,aod::CentNGlobals*/>::iterator const& collision,
930+
void dataProcess(soa::Join<aod::StraCollisions, aod::StraEvSels, aod::PVMults, aod::CentFT0Ms /*,aod::CentNGlobals*/>::iterator const& collision,
931931
aod::V0Datas const& V0s,
932932
DaughterTracks const&)
933933
{
@@ -947,6 +947,79 @@ struct V0PtInvMassPlots {
947947
std::vector<double> lambdaptedgevalues(nLambdaHistograms + 1);
948948
std::vector<double> antilambdaPtedgevalues(nAntilambdaHistograms + 1);
949949

950+
for (int i = 0; i < nKaonHistograms + 1; i++) {
951+
kaonptedgevalues[i] = std::stod(pthistos::kaonPtBins[i]);
952+
}
953+
for (int i = 0; i < nLambdaHistograms + 1; i++) {
954+
lambdaptedgevalues[i] = std::stod(pthistos::lambdaPtBins[i]);
955+
}
956+
for (int i = 0; i < nAntilambdaHistograms + 1; i++) {
957+
antilambdaPtedgevalues[i] = std::stod(pthistos::antilambdaPtBins[i]);
958+
}
959+
// Add 2D histogram with Centrality and Nch
960+
if (!acceptEvent(collision)) { // Event Selection
961+
return;
962+
}
963+
// Add 2D histogram with Centrality and Nch
964+
rMCCorrections.fill(HIST("hNRecEvents"), 0.5, collision.centFT0M()); // Number of recorded events
965+
for (const auto& v0 : V0s) {
966+
// Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace)
967+
if (!acceptV0(v0)) { // V0 Selection
968+
continue;
969+
}
970+
// kzero analysis
971+
if (kzeroAnalysis == true) {
972+
if (acceptK0sh(v0)) { // K0sh Selection
973+
for (int i = 0; i < nKaonHistograms; i++) {
974+
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges
975+
pthistos::kaonPt[i]->Fill(v0.mK0Short(), collision.centFT0M()); // filling the k0s namespace histograms
976+
}
977+
}
978+
}
979+
}
980+
// lambda analysis
981+
if (lambdaAnalysis == true) {
982+
if (acceptLambda(v0)) { // Lambda Selection
983+
for (int i = 0; i < nLambdaHistograms; i++) {
984+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
985+
pthistos::lambdaPt[i]->Fill(v0.mLambda(), collision.centFT0M());
986+
}
987+
}
988+
}
989+
}
990+
// anti-lambda analysis
991+
if (antiLambdaAnalysis == true) {
992+
if (acceptAntilambda(v0)) { // Antilambda Selection
993+
for (int i = 0; i < nAntilambdaHistograms; i++) {
994+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
995+
pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda(), collision.centFT0M());
996+
}
997+
}
998+
}
999+
}
1000+
}
1001+
}
1002+
// This is the process for Real Derived Data
1003+
void dataProcessDerived(soa::Join<aod::StraCollisions, aod::StraEvSels, aod::PVMults, aod::CentFT0Ms /*,aod::CentNGlobals*/>::iterator const& collision,
1004+
aod::V0Datas const& V0s,
1005+
DaughterTracks const&)
1006+
{
1007+
// tokenise strings into individual values
1008+
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
1009+
pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ',');
1010+
pthistos::antilambdaPtBins = o2::utils::Str::tokenize(antilambdaSettingPtBinsString, ',');
1011+
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
1012+
1013+
// Calculate number of histograms for each particle type
1014+
int nKaonHistograms = pthistos::kaonPtBins.size() - 1;
1015+
int nLambdaHistograms = pthistos::lambdaPtBins.size() - 1;
1016+
int nAntilambdaHistograms = pthistos::antilambdaPtBins.size() - 1;
1017+
1018+
// initialize and convert tokenized strings into vector of doubles for Pt Bin Edges
1019+
std::vector<double> kaonptedgevalues(nKaonHistograms + 1);
1020+
std::vector<double> lambdaptedgevalues(nLambdaHistograms + 1);
1021+
std::vector<double> antilambdaPtedgevalues(nAntilambdaHistograms + 1);
1022+
9501023
for (int i = 0; i < nKaonHistograms + 1; i++) {
9511024
kaonptedgevalues[i] = std::stod(pthistos::kaonPtBins[i]);
9521025
}
@@ -998,12 +1071,169 @@ struct V0PtInvMassPlots {
9981071
}
9991072
}
10001073
}
1074+
// This is the Process for the MC reconstructed Data
1075+
void recMCProcessDerived(soa::Join<aod::Collisions, aod::EvSels, aod::McCollisionLabels, aod::PVMults, aod::CentFT0Ms>::iterator const& collision,
1076+
// soa::Join<aod::McCollisions, aod::McCentFT0Ms> const& /*mcCollisions*/,
1077+
soa::Join<aod::V0Datas, aod::McV0Labels> const& V0s,
1078+
DaughterTracks const&, // no need to define a variable for tracks, if we don't access them directly
1079+
aod::McParticles const& /*mcParticles*/)
1080+
{
1081+
// tokenise strings into individual values
1082+
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
1083+
pthistos::lambdaPtBins = o2::utils::Str::tokenize(lambdaSettingPtBinsString, ',');
1084+
pthistos::antilambdaPtBins = o2::utils::Str::tokenize(antilambdaSettingPtBinsString, ',');
1085+
pthistos::kaonPtBins = o2::utils::Str::tokenize(kzeroSettingPtBinsString, ',');
1086+
1087+
// Calculate number of histograms for each particle type
1088+
int nKaonHistograms = pthistos::kaonPtBins.size() - 1;
1089+
int nLambdaHistograms = pthistos::lambdaPtBins.size() - 1;
1090+
int nAntilambdaHistograms = pthistos::antilambdaPtBins.size() - 1;
1091+
1092+
// initialize and convert tokenized strings into vector of doubles for Pt Bin Edges
1093+
std::vector<double> kaonptedgevalues(nKaonHistograms + 1);
1094+
std::vector<double> lambdaptedgevalues(nLambdaHistograms + 1);
1095+
std::vector<double> antilambdaPtedgevalues(nAntilambdaHistograms + 1);
1096+
1097+
for (int i = 0; i < nKaonHistograms + 1; i++) {
1098+
kaonptedgevalues[i] = std::stod(pthistos::kaonPtBins[i]);
1099+
}
1100+
for (int i = 0; i < nLambdaHistograms + 1; i++) {
1101+
lambdaptedgevalues[i] = std::stod(pthistos::lambdaPtBins[i]);
1102+
}
1103+
for (int i = 0; i < nAntilambdaHistograms + 1; i++) {
1104+
antilambdaPtedgevalues[i] = std::stod(pthistos::antilambdaPtBins[i]);
1105+
}
1106+
if (!acceptEvent(collision)) { // Event Selection
1107+
return;
1108+
}
1109+
rMCCorrections.fill(HIST("hNRecEvents"), 0.5, collision.centFT0M()); // Event Split Numenator
1110+
for (const auto& v0 : V0s) {
1111+
// Checking that the V0 is a true K0s/Lambdas/Antilambdas and then filling the parameter histograms and the invariant mass plots for different cuts (which are taken from namespace)
1112+
if (!acceptV0(v0)) { // V0 Selections
1113+
continue;
1114+
}
1115+
// kzero analysis
1116+
if (kzeroAnalysis == true) {
1117+
if (acceptK0sh(v0)) { // K0sh Selection
1118+
// K0sh Signal Split Numerator Start
1119+
for (int i = 0; i < nKaonHistograms; i++) {
1120+
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges for K0sh Splitting Numerator
1121+
pthistos::kaonSplit[i]->Fill(v0.mK0Short(), collision.centFT0M()); // filling the k0s namespace histograms for K0sh Splitting Numerator
1122+
}
1123+
}
1124+
// K0sh Signla Split Numerator End
1125+
if (v0.has_mcParticle()) {
1126+
auto v0mcParticle = v0.mcParticle();
1127+
if (dotruthk0sh && (v0mcParticle.pdgCode() == kK0Short)) { // kzero matched
1128+
if (v0mcParticle.isPhysicalPrimary()) {
1129+
for (int i = 0; i < nKaonHistograms; i++) {
1130+
if (kaonptedgevalues[i] <= v0.pt() && v0.pt() < kaonptedgevalues[i + 1]) { // finding v0s with pt within the range of our bin edges
1131+
pthistos::kaonPt[i]->Fill(v0.mK0Short(), collision.centFT0M()); // filling the k0s namespace histograms
1132+
}
1133+
}
1134+
}
1135+
if (!v0mcParticle.isPhysicalPrimary()) {
1136+
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
1137+
if (!v0mothers.empty()) {
1138+
auto& v0mcParticleMother = v0mothers.front(); // First mother
1139+
rFeeddownMatrices.fill(HIST("hK0shFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1140+
if (v0mcParticleMother.pdgCode() == kPhi) { // Phi Mother Matched
1141+
rFeeddownMatrices.fill(HIST("hK0shPhiFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1142+
}
1143+
}
1144+
}
1145+
}
1146+
}
1147+
}
1148+
}
1149+
// lambda analysis
1150+
if (lambdaAnalysis == true) {
1151+
if (acceptLambda(v0)) { // Lambda Selections
1152+
// Lambda Signal Split Numerator Start
1153+
for (int i = 0; i < nLambdaHistograms; i++) {
1154+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1155+
pthistos::lambdaSplit[i]->Fill(v0.mLambda(), collision.centFT0M());
1156+
}
1157+
}
1158+
// Lambda Signal Split Numerator End
1159+
if (v0.has_mcParticle()) {
1160+
auto v0mcParticle = v0.mcParticle();
1161+
if (dotruthLambda && (v0mcParticle.pdgCode() == kLambda0)) { // lambda matched
1162+
if (v0mcParticle.isPhysicalPrimary()) {
1163+
for (int i = 0; i < nLambdaHistograms; i++) {
1164+
if (lambdaptedgevalues[i] <= v0.pt() && v0.pt() < lambdaptedgevalues[i + 1]) {
1165+
pthistos::lambdaPt[i]->Fill(v0.mLambda(), collision.centFT0M());
1166+
}
1167+
}
1168+
}
1169+
if (!v0mcParticle.isPhysicalPrimary()) {
1170+
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
1171+
if (!v0mothers.empty()) {
1172+
auto& v0mcParticleMother = v0mothers.front(); // First mother
1173+
rFeeddownMatrices.fill(HIST("hLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1174+
if (v0mcParticleMother.pdgCode() == kXiMinus) { // Xi Minus Mother Matched
1175+
rFeeddownMatrices.fill(HIST("hLambdaXiMinusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1176+
}
1177+
if (v0mcParticleMother.pdgCode() == kXi0) { // Xi Zero Mother Matched
1178+
rFeeddownMatrices.fill(HIST("hLambdaXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1179+
}
1180+
if (v0mcParticleMother.pdgCode() == kOmegaMinus) { // Omega Mother Matched
1181+
rFeeddownMatrices.fill(HIST("hLambdaOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1182+
}
1183+
}
1184+
}
1185+
}
1186+
}
1187+
}
1188+
}
1189+
// antilambda analysis
1190+
if (antiLambdaAnalysis == true) {
1191+
if (acceptAntilambda(v0)) { // Antilambda Selections
1192+
// Antilambda Signal Split Numerator End
1193+
for (int i = 0; i < nAntilambdaHistograms; i++) {
1194+
if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) {
1195+
pthistos::antilambdaSplit[i]->Fill(v0.mAntiLambda(), collision.centFT0M());
1196+
}
1197+
}
1198+
// Antilambda Signal Split Numerator End
1199+
if (v0.has_mcParticle()) {
1200+
auto v0mcParticle = v0.mcParticle();
1201+
if (dotruthAntilambda && (v0mcParticle.pdgCode() == kLambda0Bar)) { // antilambda matched
1202+
if (v0mcParticle.isPhysicalPrimary()) {
1203+
for (int i = 0; i < nAntilambdaHistograms; i++) {
1204+
if (antilambdaPtedgevalues[i] <= v0.pt() && v0.pt() < antilambdaPtedgevalues[i + 1]) {
1205+
pthistos::antilambdaPt[i]->Fill(v0.mAntiLambda(), collision.centFT0M());
1206+
}
1207+
}
1208+
}
1209+
if (!v0mcParticle.isPhysicalPrimary()) {
1210+
auto v0mothers = v0mcParticle.mothers_as<aod::McParticles>(); // Get mothers
1211+
if (!v0mothers.empty()) {
1212+
auto& v0mcParticleMother = v0mothers.front(); // First mother
1213+
rFeeddownMatrices.fill(HIST("hAntiLambdaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1214+
if (v0mcParticleMother.pdgCode() == kXiPlusBar) { // Xi Plus Mother Matched
1215+
rFeeddownMatrices.fill(HIST("hAntiLambdaXiPlusFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1216+
}
1217+
if (v0mcParticleMother.pdgCode() == -kXi0) { // Anti-Xi Zero Mother Matched
1218+
rFeeddownMatrices.fill(HIST("hAntiLambdaAntiXiZeroFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1219+
}
1220+
if (v0mcParticleMother.pdgCode() == kOmegaPlusBar) { // Anti-Omega (minus) Mother Matched
1221+
rFeeddownMatrices.fill(HIST("hAntiLambdaAntiOmegaFeeddownMatrix"), v0mcParticle.pt(), v0mcParticleMother.pt(), collision.centFT0M());
1222+
}
1223+
}
1224+
}
1225+
}
1226+
}
1227+
}
1228+
}
1229+
}
1230+
}
10011231
PROCESS_SWITCH(V0PtInvMassPlots, genMCProcess, "Process Run 3 MC Generated", false);
10021232
PROCESS_SWITCH(V0PtInvMassPlots, recMCProcess, "Process Run 3 MC Reconstructed", false);
10031233
PROCESS_SWITCH(V0PtInvMassPlots, dataProcess, "Process Run 3 Data,", false);
10041234
// PROCESS_SWITCH(V0PtInvMassPlots, genMCProcessDerived, "Process Run 3 MC Generated", false);
1005-
// PROCESS_SWITCH(V0PtInvMassPlots, recMCProcessDerived, "Process Run 3 MC Reconstructed", false);
1006-
// PROCESS_SWITCH(V0PtInvMassPlots, dataProcessDerived, "Process Run 3 Data,", true);
1235+
PROCESS_SWITCH(V0PtInvMassPlots, recMCProcessDerived, "Process Run 3 MC Reconstructed", false);
1236+
PROCESS_SWITCH(V0PtInvMassPlots, dataProcessDerived, "Process Run 3 Data,", false);
10071237
};
10081238

10091239
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)

0 commit comments

Comments
 (0)