Skip to content

Commit 5ae7e25

Browse files
sangwoosangwoo
authored andcommitted
adding EventMixing
1 parent 1442802 commit 5ae7e25

File tree

1 file changed

+114
-0
lines changed

1 file changed

+114
-0
lines changed

PWGLF/Tasks/Resonances/f0980pbpbanalysis.cxx

Lines changed: 114 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;
@@ -191,6 +200,8 @@ struct F0980pbpbanalysis {
191200
using EventCandidates = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::FT0Mults, aod::FV0Mults, aod::TPCMults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0Cs, aod::CentFT0As, aod::Mults, aod::Qvectors>>;
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 추가됨
203+
204+
using BinningTypeVertexContributor = ColumnBinningPolicy<aod::collision::PosZ, aod::cent::CentFT0C>;
194205

195206
template <typename T>
196207
int getDetId(const T& name)
@@ -482,6 +493,109 @@ 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 (auto& [c1, t1, c2, t2] : pair) {
506+
std::cout << "--------------------------------" << std::endl;
507+
std::cout << "1st collision ID: " << c1.globalIndex() << " 1st collision bcID: "<< c1.bcId() << " 2nd collision ID: " << c2.globalIndex() << " 2nd collision bcID: " << c2.bcId() << std::endl;
508+
if (c1.globalIndex() != c1.index()) {
509+
std::cout << "WARNING: Mixing events with different global indices!" << std::endl;
510+
}
511+
if (cfgCentEst == CentEstList::FT0C) {
512+
centrality = c1.centFT0C();
513+
} else if (cfgCentEst == CentEstList::FT0M) {
514+
centrality = c1.centFT0M();
515+
}
516+
if (!eventSelected(c1) || !eventSelected(c2)) {
517+
continue;
518+
}
519+
if (c1.bcId() == c2.bcId()) {
520+
continue;
521+
}
522+
double eventPlaneDet = std::atan2(c1.qvecIm()[qVecDetInd], c1.qvecRe()[qVecDetInd]) / static_cast<float>(nmode);
523+
int total = 0;
524+
int survive = 0;
525+
526+
for (auto& trk1 : t1) {
527+
if (!trackSelected(trk1)) {
528+
continue;
529+
}
530+
if (!selectionPID(trk1)) {
531+
continue;
532+
}
533+
534+
for (auto& trk2 : t2) {
535+
if (!trackSelected(trk2)) {
536+
continue;
537+
}
538+
if (!selectionPID(trk2)) {
539+
continue;
540+
}
541+
if (!indexSelection(trk1, trk2)) {
542+
continue;
543+
}
544+
if (!selectionPair(trk1, trk2)) {
545+
continue;
546+
}
547+
ptl1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPtl);
548+
ptl2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPtl);
549+
recoPtl = ptl1 + ptl2;
550+
if (recoPtl.Rapidity() > cfgRapMax || recoPtl.Rapidity() < cfgRapMin) {
551+
continue;
552+
}
553+
554+
relPhiMix = TVector2::Phi_0_2pi((recoPtl.Phi() - eventPlaneDet) * static_cast<float>(nmode));
555+
556+
if (trk1.sign() * trk2.sign() < 0) {
557+
histos.fill(HIST("hInvMass_f0980_MixedUS_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
558+
} else if (trk1.sign() > 0 && trk2.sign() > 0) {
559+
histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
560+
} else if (trk1.sign() < 0 && trk2.sign() < 0) {
561+
histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
562+
}
563+
}
564+
}
565+
// for (auto& [trk1, trk2] : o2::soa::combinations(o2::soa::CombinationsFullIndexPolicy(t1, t2))) {
566+
// if (!trackSelected(trk1) || !trackSelected(trk2)) {
567+
// continue;
568+
// }
569+
// if (!selectionPID(trk1) || !selectionPID(trk2)) {
570+
// continue;
571+
// }
572+
// if (!indexSelection(trk1, trk2)) {
573+
// continue;
574+
// }
575+
// if (!selectionPair(trk1, trk2)) {
576+
// continue;
577+
// }
578+
// ptl1 = ROOT::Math::PxPyPzMVector(trk1.px(), trk1.py(), trk1.pz(), massPtl);
579+
// ptl2 = ROOT::Math::PxPyPzMVector(trk2.px(), trk2.py(), trk2.pz(), massPtl);
580+
// recoPtl = ptl1 + ptl2;
581+
// if (recoPtl.Rapidity() > cfgRapMax || recoPtl.Rapidity() < cfgRapMin) {
582+
// continue;
583+
// }
584+
585+
// relPhiMix = TVector2::Phi_0_2pi((recoPtl.Phi() - eventPlaneDet) * static_cast<float>(nmode));
586+
587+
// if (trk1.sign() * trk2.sign() < 0) {
588+
// histos.fill(HIST("hInvMass_f0980_MixedUS_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
589+
// } else if (trk1.sign() > 0 && trk2.sign() > 0) {
590+
// histos.fill(HIST("hInvMass_f0980_MixedLSpp_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
591+
// } else if (trk1.sign() < 0 && trk2.sign() < 0) {
592+
// histos.fill(HIST("hInvMass_f0980_MixedLSmm_EPA"), recoPtl.M(), recoPtl.Pt(), centrality, relPhiMix);
593+
// }
594+
// }
595+
}
596+
}
597+
PROCESS_SWITCH(F0980pbpbanalysis, processEventMixing, "Process Event mixing", true);
598+
485599
void init(o2::framework::InitContext&)
486600
{
487601
AxisSpec epAxis = {6, 0.0, o2::constants::math::TwoPI};

0 commit comments

Comments
 (0)