Skip to content

Commit 77e4df7

Browse files
authored
[PWGLF] Add new process function to calculate event plane dependent phi meson weight (#10174)
1 parent 2197be7 commit 77e4df7

File tree

1 file changed

+160
-6
lines changed

1 file changed

+160
-6
lines changed

PWGLF/Tasks/Resonances/phipbpb.cxx

Lines changed: 160 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ struct phipbpb {
142142

143143
using CollisionMCTrueTable = aod::McCollisions;
144144
using TrackMCTrueTable = aod::McParticles;
145+
145146
using CollisionMCRecTableCentFT0C = soa::SmallGroups<soa::Join<aod::McCollisionLabels, aod::Collisions, aod::CentFT0Cs, aod::EvSels>>;
146147
using TrackMCRecTable = soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::McTrackLabels, aod::TrackSelection, aod::pidTOFbeta, aod::pidTPCFullKa, aod::pidTOFFullKa>;
147148
using FilTrackMCRecTable = soa::Filtered<TrackMCRecTable>;
148-
149149
Preslice<TrackMCRecTable> perCollision = aod::track::collisionId;
150150

151151
SliceCache cache;
@@ -253,6 +253,9 @@ struct phipbpb {
253253
histos.add("hSparseV2MCRecCosThetaStar_effy", "hSparseV2SameEventCosThetaStar_effy", HistType::kTHnSparseD, {thnAxisInvMass, thnAxisPt, thnAxisCosThetaStar, thnAxisRapidity, thnAxisCentrality});
254254

255255
// weight
256+
histos.add("hSparsePhiMCGenWeight", "hSparsePhiMCGenWeight", HistType::kTHnSparseD, {thnAxisCentrality, {36, 0.0f, TMath::Pi()}, {400, 0.0f, 1}, thnAxisPt, {8, -0.8, 0.8}});
257+
histos.add("hSparsePhiMCRecWeight", "hSparsePhiMCRecWeight", HistType::kTHnSparseD, {thnAxisCentrality, {36, 0.0f, TMath::Pi()}, {400, 0.0f, 1}, thnAxisPt, {8, -0.8, 0.8}});
258+
256259
histos.add("hImpactParameter", "Impact parameter", kTH1F, {{200, 0.0f, 20.0f}});
257260
histos.add("hEventPlaneAngle", "hEventPlaneAngle", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}});
258261
histos.add("hEventPlaneAngleRec", "hEventPlaneAngleRec", kTH1F, {{200, -2.0f * TMath::Pi(), 2.0f * TMath::Pi()}});
@@ -410,7 +413,8 @@ struct phipbpb {
410413
ROOT::Math::XYZVector threeVecDauCM, threeVecDauCMXY, eventplaneVec, eventplaneVecNorm, beamvector;
411414
int currentRunNumber = -999;
412415
int lastRunNumber = -999;
413-
TH3D* hweight;
416+
// TH3D* hweight;
417+
TH2D* hweight;
414418
void processSameEvent(EventCandidates::iterator const& collision, TrackCandidates const& /*tracks, aod::BCs const&*/, aod::BCsWithTimestamps const&)
415419
{
416420
if (!collision.sel8() || !collision.triggereventep() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV) || !collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
@@ -470,7 +474,8 @@ struct phipbpb {
470474
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
471475
currentRunNumber = collision.bc_as<aod::BCsWithTimestamps>().runNumber();
472476
if (useWeight && (currentRunNumber != lastRunNumber)) {
473-
hweight = ccdb->getForTimeStamp<TH3D>(ConfWeightPath.value, bc.timestamp());
477+
// hweight = ccdb->getForTimeStamp<TH3D>(ConfWeightPath.value, bc.timestamp());
478+
hweight = ccdb->getForTimeStamp<TH2D>(ConfWeightPath.value, bc.timestamp());
474479
}
475480
lastRunNumber = currentRunNumber;
476481
int Npostrack = 0;
@@ -500,7 +505,8 @@ struct phipbpb {
500505
auto track1ID = track1.globalIndex();
501506
if (useWeight) {
502507
if (track1.pt() < 10.0 && track1.pt() > 0.15) {
503-
weight1 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track1.phi() - psiFT0C), track1.pt() + 0.000005));
508+
// weight1 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track1.phi() - psiFT0C), track1.pt() + 0.000005));
509+
weight1 = 1 + hweight->GetBinContent(hweight->FindBin(centrality, track1.pt() + 0.000005)) * TMath::Cos(2.0 * GetPhiInRange(track1.phi() - psiFT0C));
504510
} else {
505511
weight1 = 1;
506512
}
@@ -538,7 +544,8 @@ struct phipbpb {
538544
}
539545
if (useWeight) {
540546
if (track2.pt() < 10.0 && track2.pt() > 0.15) {
541-
weight2 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track2.phi() - psiFT0C), track2.pt() + 0.000005));
547+
// weight2 = hweight->GetBinContent(hweight->FindBin(centrality, GetPhiInRange(track2.phi() - psiFT0C), track2.pt() + 0.000005));
548+
weight2 = 1 + hweight->GetBinContent(hweight->FindBin(centrality, track2.pt() + 0.000005)) * TMath::Cos(2.0 * GetPhiInRange(track2.phi() - psiFT0C));
542549
} else {
543550
weight2 = 1;
544551
}
@@ -552,7 +559,7 @@ struct phipbpb {
552559
auto phimother = PhiMesonMother.Phi();
553560
histos.fill(HIST("hpTvsRapidity"), PhiMesonMother.Pt(), PhiMesonMother.Rapidity());
554561
auto totalweight = weight1 * weight2;
555-
if (totalweight <= 0.0005) {
562+
if (totalweight <= 0.0000005) {
556563
totalweight = 1.0;
557564
}
558565
// LOGF(info, Form("weight %f %f",weight1, weight2));
@@ -992,6 +999,153 @@ struct phipbpb {
992999
histos.fill(HIST("hNchVsImpactParameter"), imp, nCh);
9931000
}
9941001
PROCESS_SWITCH(phipbpb, processMCweight, "Process MC Weight", false);
1002+
1003+
void processMCPhiWeight(CollisionMCTrueTable::iterator const& TrueCollision, CollisionMCRecTableCentFT0C const& RecCollisions, TrackMCTrueTable const& GenParticles, FilTrackMCRecTable const& RecTracks)
1004+
{
1005+
float imp = TrueCollision.impactParameter();
1006+
float evPhi = TrueCollision.eventPlaneAngle() / 2.0;
1007+
float centclass = -999;
1008+
if (imp >= 0 && imp < 3.49) {
1009+
centclass = 2.5;
1010+
}
1011+
if (imp >= 3.49 && imp < 4.93) {
1012+
centclass = 7.5;
1013+
}
1014+
if (imp >= 4.93 && imp < 6.98) {
1015+
centclass = 15.0;
1016+
}
1017+
if (imp >= 6.98 && imp < 8.55) {
1018+
centclass = 25.0;
1019+
}
1020+
if (imp >= 8.55 && imp < 9.87) {
1021+
centclass = 35.0;
1022+
}
1023+
if (imp >= 9.87 && imp < 11) {
1024+
centclass = 45.0;
1025+
}
1026+
if (imp >= 11 && imp < 12.1) {
1027+
centclass = 55.0;
1028+
}
1029+
if (imp >= 12.1 && imp < 13.1) {
1030+
centclass = 65.0;
1031+
}
1032+
if (imp >= 13.1 && imp < 14) {
1033+
centclass = 75.0;
1034+
}
1035+
histos.fill(HIST("hImpactParameter"), imp);
1036+
histos.fill(HIST("hEventPlaneAngle"), evPhi);
1037+
if (centclass < 0.0 || centclass > 80.0) {
1038+
return;
1039+
}
1040+
for (auto& RecCollision : RecCollisions) {
1041+
auto psiFT0C = evPhi;
1042+
if (!RecCollision.sel8()) {
1043+
continue;
1044+
}
1045+
if (!RecCollision.selection_bit(aod::evsel::kNoITSROFrameBorder)) {
1046+
continue;
1047+
}
1048+
if (TMath::Abs(RecCollision.posZ()) > cfgCutVertex) {
1049+
continue;
1050+
}
1051+
auto oldindex = -999;
1052+
auto Rectrackspart = RecTracks.sliceBy(perCollision, RecCollision.globalIndex());
1053+
// loop over reconstructed particle
1054+
for (auto track1 : Rectrackspart) {
1055+
if (!track1.has_mcParticle()) {
1056+
continue;
1057+
}
1058+
auto track1ID = track1.index();
1059+
for (auto track2 : Rectrackspart) {
1060+
if (!track2.has_mcParticle()) {
1061+
continue;
1062+
}
1063+
auto track2ID = track2.index();
1064+
if (track2ID <= track1ID) {
1065+
continue;
1066+
}
1067+
const auto mctrack1 = track1.mcParticle();
1068+
const auto mctrack2 = track2.mcParticle();
1069+
int track1PDG = TMath::Abs(mctrack1.pdgCode());
1070+
int track2PDG = TMath::Abs(mctrack2.pdgCode());
1071+
if (!mctrack1.isPhysicalPrimary()) {
1072+
continue;
1073+
}
1074+
if (!mctrack2.isPhysicalPrimary()) {
1075+
continue;
1076+
}
1077+
if (!(track1PDG == 321 && track2PDG == 321)) {
1078+
continue;
1079+
}
1080+
if (!selectionTrack(track1) || !selectionTrack(track2) || !selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2) || track1.sign() * track2.sign() > 0) {
1081+
continue;
1082+
}
1083+
for (auto& mothertrack1 : mctrack1.mothers_as<aod::McParticles>()) {
1084+
for (auto& mothertrack2 : mctrack2.mothers_as<aod::McParticles>()) {
1085+
if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) {
1086+
continue;
1087+
}
1088+
if (mothertrack1 != mothertrack2) {
1089+
continue;
1090+
}
1091+
if (TMath::Abs(mothertrack1.y()) > confRapidity) {
1092+
continue;
1093+
}
1094+
if (TMath::Abs(mothertrack1.pdgCode()) != 333) {
1095+
continue;
1096+
}
1097+
// if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) {
1098+
if (avoidsplitrackMC && oldindex == mothertrack1.index()) {
1099+
histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt());
1100+
continue;
1101+
}
1102+
// oldindex = mothertrack1.globalIndex();
1103+
oldindex = mothertrack1.index();
1104+
auto PhiMinusPsi = GetPhiInRange(mothertrack1.phi() - psiFT0C);
1105+
histos.fill(HIST("hSparsePhiMCRecWeight"), centclass, PhiMinusPsi, TMath::Power(TMath::Cos(2.0 * PhiMinusPsi), 2.0), mothertrack1.pt(), mothertrack1.eta());
1106+
}
1107+
}
1108+
}
1109+
}
1110+
// loop over generated particle
1111+
for (auto& mcParticle : GenParticles) {
1112+
if (TMath::Abs(mcParticle.y()) > confRapidity) {
1113+
continue;
1114+
}
1115+
if (mcParticle.pdgCode() != 333) {
1116+
continue;
1117+
}
1118+
auto kDaughters = mcParticle.daughters_as<aod::McParticles>();
1119+
if (kDaughters.size() != 2) {
1120+
continue;
1121+
}
1122+
auto daughtp = false;
1123+
auto daughtm = false;
1124+
for (auto kCurrentDaughter : kDaughters) {
1125+
if (!kCurrentDaughter.isPhysicalPrimary()) {
1126+
continue;
1127+
}
1128+
if (kCurrentDaughter.pdgCode() == +321) {
1129+
if (kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) {
1130+
daughtp = true;
1131+
}
1132+
KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa);
1133+
} else if (kCurrentDaughter.pdgCode() == -321) {
1134+
if (kCurrentDaughter.pt() > cfgCutPT && TMath::Abs(kCurrentDaughter.eta()) < cfgCutEta) {
1135+
daughtm = true;
1136+
}
1137+
KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa);
1138+
}
1139+
}
1140+
if (daughtp && daughtm) {
1141+
auto PhiMinusPsiGen = GetPhiInRange(mcParticle.phi() - psiFT0C);
1142+
histos.fill(HIST("hSparsePhiMCGenWeight"), centclass, PhiMinusPsiGen, TMath::Power(TMath::Cos(2.0 * PhiMinusPsiGen), 2.0), mcParticle.pt(), mcParticle.eta());
1143+
}
1144+
}
1145+
} // rec collision loop
1146+
1147+
} // process MC
1148+
PROCESS_SWITCH(phipbpb, processMCPhiWeight, "Process MC Phi Weight", false);
9951149
};
9961150
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
9971151
{

0 commit comments

Comments
 (0)