Skip to content

Commit 984e93f

Browse files
sarjeetagamisarjeeta gami
andauthored
[PWGLF] added MC process for closure test (#10091)
Co-authored-by: sarjeeta gami <sarjeetagami@sarjeetas-MacBook-Air.local>
1 parent f7872d6 commit 984e93f

File tree

1 file changed

+103
-30
lines changed

1 file changed

+103
-30
lines changed

PWGLF/Tasks/Resonances/phianalysisrun3_PbPb.cxx

Lines changed: 103 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,14 @@ struct phianalysisrun3_PbPb {
121121
histos.add("Centgen", "MC Centrality", kTH1F, {{200, 0.0, 200.0}});
122122
histos.add("h2PhiRec2", "Phi meson Rec", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}});
123123
histos.add("h3PhiRec3", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}});
124+
histos.add("h3Phi1Rec3", "Phi meson Rec", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}});
125+
histos.add("h3PhiGen3", "Phi meson Gen", kTH3F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}, {200, 0.9, 1.1}});
126+
histos.add("h3PhiInvMassMixedMC", "Invariant mass of Phi meson Mixed", kTH3F, {{200, 0.0, 200.0}, {200, 0.0f, 20.0f}, {200, 0.9, 1.1}});
124127
histos.add("h2PhiGen2", "Phi meson gen", kTH2F, {{200, 0.0f, 20.0f}, {200, 0.0, 200.0}});
125128
histos.add("h1PhiRec1", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}});
126129
histos.add("h1Phimassgen", "Phi meson gen", kTH1F, {{200, 0.9, 1.1}});
127130
histos.add("h1Phimassrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}});
131+
histos.add("h1Phi1massrec", "Phi meson Rec", kTH1F, {{200, 0.9, 1.1}});
128132
histos.add("h1Phipt", "Phi meson Rec", kTH1F, {{200, 0.0f, 20.0f}});
129133
histos.add("hOccupancy1", "Occupancy distribution", kTH1F, {{500, 0, 50000}});
130134
histos.add("TOF_Nsigma_MC", "TOF NSigma for Kaon;#it{p}_{T} (GeV/#it{c});#sigma_{TOF}^{Kaon};", {HistType::kTH2D, {{200, -12, 12}, {200, 0.0, 200.0}}});
@@ -149,6 +153,7 @@ struct phianalysisrun3_PbPb {
149153
double massKa = o2::constants::physics::MassKPlus;
150154
double rapidity;
151155
double genMass, recMass, resolution;
156+
ROOT::Math::PxPyPzMVector phiMother, daughter1, daughter2;
152157
double mass{0.};
153158
double massrotation{0.};
154159
double pT{0.};
@@ -353,10 +358,10 @@ struct phianalysisrun3_PbPb {
353358
int occupancy1 = c1.trackOccupancyInTimeRange();
354359
int occupancy2 = c2.trackOccupancyInTimeRange();
355360
if (fillOccupancy && !(occupancy1 > cfgOccupancyCut1 && occupancy1 < cfgOccupancyCut2)) {
356-
return;
361+
continue;
357362
}
358363
if (fillOccupancy && !(occupancy2 > cfgOccupancyCut1 && occupancy2 < cfgOccupancyCut2)) {
359-
return;
364+
continue;
360365
}
361366
float multiplicity;
362367
if (cfgMultFT0)
@@ -649,17 +654,6 @@ struct phianalysisrun3_PbPb {
649654
if (std::abs(mcCollision.posZ()) < cfgCutVertex) {
650655
histos.fill(HIST("hMC"), 1.5);
651656
}
652-
int Nchinel = 0;
653-
for (auto& mcParticle : mcParticles) {
654-
auto pdgcode = std::abs(mcParticle.pdgCode());
655-
if (mcParticle.isPhysicalPrimary() && (pdgcode == 211 || pdgcode == 321 || pdgcode == 2212 || pdgcode == 11 || pdgcode == 13)) {
656-
if (std::abs(mcParticle.eta()) < 1.0) {
657-
Nchinel = Nchinel + 1;
658-
}
659-
}
660-
}
661-
if (Nchinel > 0 && std::abs(mcCollision.posZ()) < cfgCutVertex)
662-
histos.fill(HIST("hMC"), 2.5);
663657
std::vector<int64_t> SelectedEvents(collisions.size());
664658
int nevts = 0;
665659
auto multiplicity = 0;
@@ -702,13 +696,18 @@ struct phianalysisrun3_PbPb {
702696
}
703697
if (kCurrentDaughter.pdgCode() == +321) {
704698
daughtp = true;
699+
KaonPlus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa);
705700
} else if (kCurrentDaughter.pdgCode() == -321) {
706701
daughtm = true;
702+
KaonMinus = ROOT::Math::PxPyPzMVector(kCurrentDaughter.px(), kCurrentDaughter.py(), kCurrentDaughter.pz(), massKa);
707703
}
708704
}
709705
if (daughtp && daughtm) {
710-
histos.fill(HIST("h1PhiGen"), mcParticle.pt());
711-
histos.fill(HIST("h2PhiGen2"), mcParticle.pt(), multiplicity);
706+
PhiMesonMother = KaonPlus + KaonMinus;
707+
histos.fill(HIST("h1PhiGen"), PhiMesonMother.pt());
708+
histos.fill(HIST("h2PhiGen2"), PhiMesonMother.pt(), multiplicity);
709+
histos.fill(HIST("h1Phimassgen"), PhiMesonMother.M());
710+
histos.fill(HIST("h3PhiGen3"), PhiMesonMother.pt(), multiplicity, PhiMesonMother.M());
712711
}
713712
}
714713
}
@@ -767,6 +766,12 @@ struct phianalysisrun3_PbPb {
767766
if (!(track1PDG == 321 && track2PDG == 321)) {
768767
continue;
769768
}
769+
daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
770+
daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa);
771+
772+
phiMother = daughter1 + daughter2;
773+
histos.fill(HIST("h1Phi1massrec"), phiMother.M());
774+
histos.fill(HIST("h3Phi1Rec3"), phiMother.pt(), multiplicity, phiMother.M());
770775
for (auto& mothertrack1 : mctrack1.mothers_as<aod::McParticles>()) {
771776
for (auto& mothertrack2 : mctrack2.mothers_as<aod::McParticles>()) {
772777
if (mothertrack1.pdgCode() != mothertrack2.pdgCode()) {
@@ -790,33 +795,101 @@ struct phianalysisrun3_PbPb {
790795
if (ispTdepPID && (!selectionPIDpTdependent(track1) || !selectionPIDpTdependent(track2))) {
791796
continue;
792797
}
798+
799+
histos.fill(HIST("TPC_Nsigma_MC"), track1.tpcNSigmaKa(), multiplicity);
800+
histos.fill(HIST("TOF_Nsigma_MC"), track1.tofNSigmaKa(), multiplicity);
793801
if (avoidsplitrackMC && oldindex == mothertrack1.globalIndex()) {
794802
histos.fill(HIST("h1PhiRecsplit"), mothertrack1.pt());
795803
continue;
796804
}
797-
histos.fill(HIST("TPC_Nsigma_MC"), track1.tpcNSigmaKa(), multiplicity);
798-
histos.fill(HIST("TOF_Nsigma_MC"), track1.tofNSigmaKa(), multiplicity);
799805
oldindex = mothertrack1.globalIndex();
800-
pvec0 = array{track1.px(), track1.py(), track1.pz()};
801-
pvec1 = array{track2.px(), track2.py(), track2.pz()};
802-
auto arrMomrec = array{pvec0, pvec1};
803-
auto motherP = mothertrack1.p();
804-
auto motherE = mothertrack1.e();
805-
genMass = std::sqrt(motherE * motherE - motherP * motherP);
806-
recMass = RecoDecay::m(arrMomrec, array{massKa, massKa});
807-
auto recpt = TMath::Sqrt((track1.px() + track2.px()) * (track1.px() + track2.px()) + (track1.py() + track2.py()) * (track1.py() + track2.py()));
808-
histos.fill(HIST("h1PhiRec1"), mothertrack1.pt());
809-
histos.fill(HIST("h2PhiRec2"), mothertrack1.pt(), multiplicity);
810-
histos.fill(HIST("h1Phimassgen"), genMass);
811-
histos.fill(HIST("h1Phimassrec"), recMass);
812-
histos.fill(HIST("h1Phipt"), recpt);
806+
if (track1.sign() * track2.sign() < 0) {
807+
KaonPlus = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
808+
KaonMinus = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massKa);
809+
}
810+
PhiMesonMother = KaonPlus + KaonMinus;
811+
812+
if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) {
813+
continue;
814+
}
815+
histos.fill(HIST("h1PhiRec1"), PhiMesonMother.pt());
816+
histos.fill(HIST("h2PhiRec2"), PhiMesonMother.pt(), multiplicity);
817+
histos.fill(HIST("h1Phimassrec"), PhiMesonMother.M());
818+
histos.fill(HIST("h3PhiRec3"), PhiMesonMother.pt(), multiplicity, PhiMesonMother.M());
813819
}
814820
}
815821
}
816822
}
817823
}
818824

819825
PROCESS_SWITCH(phianalysisrun3_PbPb, processRec, "Process Reconstructed", false);
826+
void processMixedEventMC(EventCandidatesMC const& recCollisions, TrackCandidatesMC const& RecTracks, aod::McParticles const&)
827+
{
828+
829+
auto tracksTuple = std::make_tuple(RecTracks);
830+
BinningTypeVertexContributor binningOnPositions{{axisVertex, axisMultiplicity}, true};
831+
SameKindPair<EventCandidatesMC, TrackCandidatesMC, BinningTypeVertexContributor> pairs{binningOnPositions, cfgNoMixedEvents, -1, recCollisions, tracksTuple, &cache};
832+
833+
for (auto& [c1, tracks1, c2, tracks2] : pairs) {
834+
if (!c1.sel8()) {
835+
continue;
836+
}
837+
if (!c2.sel8()) {
838+
continue;
839+
}
840+
if (additionalEvSel2 && (!c1.selection_bit(aod::evsel::kNoSameBunchPileup) || !c1.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
841+
continue;
842+
}
843+
if (additionalEvSel2 && (!c2.selection_bit(aod::evsel::kNoSameBunchPileup) || !c2.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV))) {
844+
continue;
845+
}
846+
if (additionalEvSel3 && (!c1.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) {
847+
continue;
848+
}
849+
if (additionalEvSel3 && (!c2.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard))) {
850+
continue;
851+
}
852+
int occupancy1 = c1.trackOccupancyInTimeRange();
853+
int occupancy2 = c2.trackOccupancyInTimeRange();
854+
if (fillOccupancy && !(occupancy1 > cfgOccupancyCut1 && occupancy1 < cfgOccupancyCut2)) {
855+
continue;
856+
}
857+
if (fillOccupancy && !(occupancy2 > cfgOccupancyCut1 && occupancy2 < cfgOccupancyCut2)) {
858+
continue;
859+
}
860+
auto multiplicity = c1.centFT0C();
861+
for (auto& [t1, t2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(tracks1, tracks2))) {
862+
histos.fill(HIST("hMC"), 6.5);
863+
if (!selectionTrack(t1)) {
864+
continue;
865+
}
866+
if (!selectionTrack(t2)) {
867+
continue;
868+
}
869+
if (!selectionPair(t1, t2)) {
870+
continue;
871+
}
872+
if (!ispTdepPID && (!selectionPID(t1) || !selectionPID(t2))) {
873+
continue;
874+
}
875+
if (ispTdepPID && (!selectionPIDpTdependent(t1) || !selectionPIDpTdependent(t2))) {
876+
continue;
877+
}
878+
histos.fill(HIST("hMC"), 7.5);
879+
if (t1.sign() * t2.sign() < 0) {
880+
KaonPlus = ROOT::Math::PxPyPzMVector(t1.px(), t1.py(), t1.pz(), massKa);
881+
KaonMinus = ROOT::Math::PxPyPzMVector(t2.px(), t2.py(), t2.pz(), massKa);
882+
}
883+
PhiMesonMother = KaonPlus + KaonMinus;
884+
if (TMath::Abs(PhiMesonMother.Rapidity()) > confRapidity) {
885+
continue;
886+
}
887+
histos.fill(HIST("hMC"), 8.5);
888+
histos.fill(HIST("h3PhiInvMassMixedMC"), multiplicity, PhiMesonMother.pt(), PhiMesonMother.M());
889+
}
890+
}
891+
}
892+
PROCESS_SWITCH(phianalysisrun3_PbPb, processMixedEventMC, "Process Mixed event MC", true);
820893
};
821894
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
822895
{

0 commit comments

Comments
 (0)