Skip to content

Commit ea0492d

Browse files
sangwoo184sangwoosangwoo
authored
[PWGLF] Added EventMixing (#12124)
Co-authored-by: sangwoo <sangwoo@sangwooui-MacBookPro.local> Co-authored-by: sangwoo <sangwoo@192.168.nate.com>
1 parent f26d142 commit ea0492d

File tree

1 file changed

+107
-0
lines changed

1 file changed

+107
-0
lines changed

PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
#include "Framework/StepTHn.h"
4848
#include "Framework/runDataProcessing.h"
4949
#include "ReconstructionDataFormats/Track.h"
50+
#include <Framework/SliceCache.h>
5051

5152
#include "Math/GenVector/Boost.h"
5253
#include "Math/Vector3D.h"
@@ -135,6 +136,13 @@ struct F0980pbpbanalysis {
135136
ConfigurableAxis ptAxis{"ptAxis", {VARIABLE_WIDTH, 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.8, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 7.0, 8.0, 10.0, 13.0, 20.0}, "Transverse momentum Binning"};
136137
ConfigurableAxis centAxis{"centAxis", {VARIABLE_WIDTH, 0, 5, 10, 20, 30, 40, 50, 60, 70, 80, 100}, "Centrality interval"};
137138

139+
// for event mixing
140+
SliceCache cache;
141+
Configurable<int> cfgNMixedEvents{"cfgNMixedEvents", 10, "Number of mixed events per event"};
142+
ConfigurableAxis mixingAxisVertex{"mixingAxisVertex", {10, -10, 10}, "Vertex axis for mixing bin"};
143+
ConfigurableAxis mixingAxisMultiplicity{"mixingAxisMultiplicity", {VARIABLE_WIDTH, 0, 10, 20, 50, 100}, "multiplicity percentile for mixing bin"};
144+
// ConfigurableAxis mixingAxisMultiplicity{"mixingAxisMultiplicity", {2000, 0, 10000}, "TPC multiplicity for bin"};
145+
138146
TF1* fMultPVCutLow = nullptr;
139147
TF1* fMultPVCutHigh = nullptr;
140148

@@ -151,6 +159,7 @@ struct F0980pbpbanalysis {
151159
double angle;
152160
double relPhi;
153161
double relPhiRot;
162+
double relPhiMix;
154163

155164
// double massPi = o2::constants::physics::MassPionCharged;
156165
double massPtl;
@@ -192,6 +201,8 @@ struct F0980pbpbanalysis {
192201
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTPCFullPi, aod::pidTOFFullPi, aod::pidTOFFullKa, aod::pidTPCFullKa, aod::pidTOFbeta>>;
193202
// aod::pidTOFbeta 추가됨
194203

204+
using BinningTypeVertexContributor = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>;
205+
195206
template <typename T>
196207
int getDetId(const T& name)
197208
{
@@ -482,6 +493,102 @@ struct F0980pbpbanalysis {
482493
}
483494
}
484495

496+
void processEventMixing(EventCandidates const& collisions, TrackCandidates const& tracks)
497+
{
498+
int nmode = 2; // second order
499+
qVecDetInd = detId * 4 + 3 + (nmode - 2) * cfgNQvec * 4;
500+
501+
auto trackTuple = std::make_tuple(tracks);
502+
BinningTypeVertexContributor binningOnPositions{{mixingAxisVertex, mixingAxisMultiplicity}, true};
503+
SameKindPair<EventCandidates, TrackCandidates, BinningTypeVertexContributor> pair{binningOnPositions, cfgNMixedEvents, -1, collisions, trackTuple, &cache};
504+
ROOT::Math::PxPyPzMVector ptl1, ptl2, recoPtl;
505+
for (const auto& [c1, t1, c2, t2] : pair) {
506+
if (cfgCentEst == CentEstList::FT0C) {
507+
centrality = c1.centFT0C();
508+
} else if (cfgCentEst == CentEstList::FT0M) {
509+
centrality = c1.centFT0M();
510+
}
511+
if (!eventSelected(c1) || !eventSelected(c2)) {
512+
continue;
513+
}
514+
if (c1.bcId() == c2.bcId()) {
515+
continue;
516+
}
517+
double eventPlaneDet = std::atan2(c1.qvecIm()[qVecDetInd], c1.qvecRe()[qVecDetInd]) / static_cast<float>(nmode);
518+
519+
for (const auto& trk1 : t1) {
520+
if (!trackSelected(trk1)) {
521+
continue;
522+
}
523+
if (!selectionPID(trk1)) {
524+
continue;
525+
}
526+
527+
for (const auto& trk2 : t2) {
528+
if (!trackSelected(trk2)) {
529+
continue;
530+
}
531+
if (!selectionPID(trk2)) {
532+
continue;
533+
}
534+
if (!indexSelection(trk1, trk2)) {
535+
continue;
536+
}
537+
if (!selectionPair(trk1, trk2)) {
538+
continue;
539+
}
540+
ptl1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPtl);
541+
ptl2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPtl);
542+
recoPtl = ptl1 + ptl2;
543+
if (recoPtl.Rapidity() > cfgRapMax || recoPtl.Rapidity() < cfgRapMin) {
544+
continue;
545+
}
546+
547+
relPhiMix = TVector2::Phi_0_2pi((recoPtl.Phi() - eventPlaneDet) * static_cast<float>(nmode));
548+
549+
if (trk1.sign() * trk2.sign() < 0) {
550+
histos.fill(HIST("hInvMass_f0980_MixedUS_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
551+
} else if (trk1.sign() > 0 && trk2.sign() > 0) {
552+
histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
553+
} else if (trk1.sign() < 0 && trk2.sign() < 0) {
554+
histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
555+
}
556+
}
557+
}
558+
// for (auto& [trk1, trk2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(t1, t2))) {
559+
// if (!trackSelected(trk1) || !trackSelected(trk2)) {
560+
// continue;
561+
// }
562+
// if (!selectionPID(trk1) || !selectionPID(trk2)) {
563+
// continue;
564+
// }
565+
// if (!indexSelection(trk1, trk2)) {
566+
// continue;
567+
// }
568+
// if (!selectionPair(trk1, trk2)) {
569+
// continue;
570+
// }
571+
// ptl1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPtl);
572+
// ptl2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPtl);
573+
// recoPtl = ptl1 + ptl2;
574+
// if (recoPtl.Rapidity() > cfgRapMax || recoPtl.Rapidity() < cfgRapMin) {
575+
// continue;
576+
// }
577+
578+
// relPhiMix = TVector2::Phi_0_2pi((recoPtl.Phi() - eventPlaneDet) * static_cast<float>(nmode));
579+
580+
// if (trk1.sign() * trk2.sign() < 0) {
581+
// histos.fill(HIST("hInvMass_f0980_MixedUS_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
582+
// } else if (trk1.sign() > 0 && trk2.sign() > 0) {
583+
// histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
584+
// } else if (trk1.sign() < 0 && trk2.sign() < 0) {
585+
// histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
586+
// }
587+
// }
588+
}
589+
}
590+
PROCESS_SWITCH(F0980pbpbanalysis, processEventMixing, "Process Event mixing", true);
591+
485592
void init(o2::framework::InitContext&)
486593
{
487594
AxisSpec epAxis = {6, 0.0, o2::constants::math::TwoPI};

0 commit comments

Comments
 (0)