Skip to content

Commit c1fcca8

Browse files
authored
[PWGLF] Initial task for first-order flow harmonics of K*(892) (#9932)
1 parent c015528 commit c1fcca8

File tree

2 files changed

+361
-0
lines changed

2 files changed

+361
-0
lines changed

PWGLF/Tasks/Resonances/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,8 @@ o2physics_add_dpl_workflow(rho770analysis
188188
SOURCES rho770analysis.cxx
189189
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
190190
COMPONENT_NAME Analysis)
191+
192+
o2physics_add_dpl_workflow(kstarpbpbv1
193+
SOURCES kstarFlowv1.cxx
194+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
195+
COMPONENT_NAME Analysis)
Lines changed: 356 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,356 @@
1+
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2+
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3+
// All rights not expressly granted are reserved.
4+
//
5+
// This software is distributed under the terms of the GNU General Public
6+
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7+
//
8+
// In applying this license CERN does not waive the privileges and immunities
9+
// granted to it by virtue of its status as an Intergovernmental Organization
10+
// or submit itself to any jurisdiction.
11+
///
12+
/// \file kstarFlowv1.cxx
13+
/// \brief first order flow harmonic for resonance
14+
/// \author Prottay Das <prottay.das@cern.ch>, Dukhishyam Mallick <dukhishyam.mallick@cern.ch>
15+
///
16+
17+
#include <TH1F.h>
18+
#include <TDirectory.h>
19+
#include <THn.h>
20+
#include <TLorentzVector.h>
21+
#include <TMath.h>
22+
#include <TObjArray.h>
23+
#include <TFile.h>
24+
#include <TH2F.h>
25+
#include <TLorentzVector.h>
26+
#include <TPDGCode.h>
27+
#include <string>
28+
#include <vector>
29+
// #include <TDatabasePDG.h>
30+
#include <cmath>
31+
#include <array>
32+
#include <cstdlib>
33+
34+
#include "TRandom3.h"
35+
#include "Math/Vector3D.h"
36+
#include "Math/Vector4D.h"
37+
#include "Math/GenVector/Boost.h"
38+
#include "TF1.h"
39+
40+
#include "Common/Core/trackUtilities.h"
41+
#include "Common/Core/TrackSelection.h"
42+
#include "Common/Core/RecoDecay.h"
43+
44+
#include "PWGLF/DataModel/SPCalibrationTables.h"
45+
#include "Framework/runDataProcessing.h"
46+
#include "Framework/AnalysisTask.h"
47+
#include "Framework/AnalysisDataModel.h"
48+
#include "Framework/HistogramRegistry.h"
49+
#include "Framework/StepTHn.h"
50+
#include "Framework/O2DatabasePDGPlugin.h"
51+
#include "Common/DataModel/PIDResponse.h"
52+
#include "Common/DataModel/Multiplicity.h"
53+
#include "Common/DataModel/Centrality.h"
54+
#include "Common/DataModel/TrackSelectionTables.h"
55+
#include "Common/DataModel/EventSelection.h"
56+
#include "Common/Core/trackUtilities.h"
57+
#include "CommonConstants/PhysicsConstants.h"
58+
#include "Common/Core/TrackSelection.h"
59+
#include "Framework/ASoAHelpers.h"
60+
#include "ReconstructionDataFormats/Track.h"
61+
#include "DataFormatsParameters/GRPObject.h"
62+
#include "DataFormatsParameters/GRPMagField.h"
63+
#include "CCDB/BasicCCDBManager.h"
64+
65+
using namespace o2;
66+
using namespace o2::framework;
67+
using namespace o2::framework::expressions;
68+
using std::array;
69+
using namespace o2::constants::physics;
70+
struct KstarFlowv1 {
71+
72+
Service<o2::ccdb::BasicCCDBManager> ccdb;
73+
// Service<o2::framework::O2DatabasePDG> pdg;
74+
75+
// events
76+
Configurable<float> cfgCutVertex{"cfgCutVertex", 10.0f, "Accepted z-vertex range"};
77+
Configurable<float> cfgCutCentrality{"cfgCutCentrality", 80.0f, "Accepted maximum Centrality"};
78+
// track
79+
Configurable<float> cfgCutCharge{"cfgCutCharge", 0.0, "cut on Charge"};
80+
Configurable<float> cfgCutPT{"cfgCutPT", 0.2, "PT cut on daughter track"};
81+
Configurable<float> cfgCutEta{"cfgCutEta", 0.8, "Eta cut on daughter track"};
82+
Configurable<float> cfgCutDCAxy{"cfgCutDCAxy", 2.0f, "DCAxy range for tracks"};
83+
Configurable<float> cfgCutDCAz{"cfgCutDCAz", 2.0f, "DCAz range for tracks"};
84+
Configurable<bool> useGlobalTrack{"useGlobalTrack", true, "use Global track"};
85+
Configurable<float> nsigmaCutTOF{"nsigmaCutTOF", 3.0, "Value of the TOF Nsigma cut"};
86+
Configurable<float> nsigmaCutTPC{"nsigmaCutTPC", 3.0, "Value of the TPC Nsigma cut"};
87+
Configurable<float> nsigmaCutCombined{"nsigmaCutCombined", 3.0, "Value of the TOF Nsigma cut"};
88+
Configurable<int> cfgNoMixedEvents{"cfgNoMixedEvents", 1, "Number of mixed events per event"};
89+
Configurable<int> cfgITScluster{"cfgITScluster", 0, "Number of ITS cluster"};
90+
Configurable<int> cfgTPCcluster{"cfgTPCcluster", 70, "Number of TPC cluster"};
91+
// Configurable<bool> removefaketrak{"removefaketrack", true, "Remove fake track from momentum difference"};
92+
Configurable<float> confFakeKaonCut{"confFakeKaonCut", 0.1, "Cut based on track from momentum difference"};
93+
Configurable<bool> ispTdepPID{"ispTdepPID", true, "pT dependent PID"};
94+
Configurable<bool> onlyTOF{"onlyTOF", true, "onlyTOF"};
95+
Configurable<int> strategyPID{"strategyPID", 2, "PID strategy"};
96+
Configurable<float> cfgCutTOFBeta{"cfgCutTOFBeta", 0.0, "cut TOF beta"};
97+
Configurable<float> confMinRot{"confMinRot", 5.0 * o2::constants::math::PI / 6.0, "Minimum of rotation"};
98+
Configurable<float> confMaxRot{"confMaxRot", 7.0 * o2::constants::math::PI / 6.0, "Maximum of rotation"};
99+
Configurable<int> nBkgRotations{"nBkgRotations", 9, "Number of rotated copies (background) per each original candidate"};
100+
Configurable<bool> fillRotation{"fillRotation", true, "fill rotation"};
101+
Configurable<bool> like{"like", true, "fill rotation"};
102+
Configurable<int> spNbins{"spNbins", 2000, "Number of bins in sp"};
103+
Configurable<float> lbinsp{"lbinsp", -1.0, "lower bin value in sp histograms"};
104+
Configurable<float> hbinsp{"hbinsp", 1.0, "higher bin value in sp histograms"};
105+
106+
ConfigurableAxis configcentAxis{"configcentAxis", {VARIABLE_WIDTH, 0.0, 10.0, 30.0, 50.0, 80.0}, "Cent V0M"};
107+
ConfigurableAxis configthnAxisPt{"configthnAxisPt", {VARIABLE_WIDTH, 0.2, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 6.5, 8.0, 10.0, 50.0}, "#it{p}_{T} (GeV/#it{c})"};
108+
ConfigurableAxis configetaAxis{"configetaAxis", {VARIABLE_WIDTH, -0.8, -0.4, -0.2, 0, 0.2, 0.4, 0.8}, "Eta"};
109+
ConfigurableAxis configIMAxis{"configIMAxis", {VARIABLE_WIDTH, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1.0, 1.05, 1.1, 1.15, 1.2}, "IM"};
110+
111+
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
112+
Filter centralityFilter = nabs(aod::cent::centFT0C) < cfgCutCentrality;
113+
Filter acceptanceFilter = (nabs(aod::track::eta) < cfgCutEta && nabs(aod::track::pt) > cfgCutPT);
114+
Filter dCAcutFilter = (nabs(aod::track::dcaXY) < cfgCutDCAxy) && (nabs(aod::track::dcaZ) < cfgCutDCAz);
115+
116+
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::SPCalibrationTables, aod::Mults>>;
117+
using TrackCandidates = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TracksDCA, aod::TrackSelection, aod::pidTOFbeta, aod::pidTPCFullKa, aod::pidTOFFullKa, aod::pidTPCFullPi, aod::pidTOFFullPi>>;
118+
119+
SliceCache cache;
120+
Partition<TrackCandidates> posTracks = aod::track::signed1Pt > cfgCutCharge;
121+
Partition<TrackCandidates> negTracks = aod::track::signed1Pt < cfgCutCharge;
122+
123+
HistogramRegistry histos{"histos", {}, OutputObjHandlingPolicy::AnalysisObject};
124+
125+
void init(o2::framework::InitContext&)
126+
{
127+
AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"};
128+
129+
histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
130+
histos.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
131+
histos.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
132+
histos.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
133+
histos.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
134+
135+
histos.add("hpv1vscentpteta", "hpv1vscentpteta", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
136+
histos.add("hpv1vscentptetarot", "hpv1vscentptetarot", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
137+
histos.add("hpv1vscentptetalike", "hpv1vscentptetalike", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
138+
}
139+
140+
double massKa = o2::constants::physics::MassKPlus;
141+
double massPi = o2::constants::physics::MassPiMinus;
142+
143+
template <typename T>
144+
bool selectionTrack(const T& candidate)
145+
{
146+
if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) {
147+
return false;
148+
}
149+
if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) {
150+
return false;
151+
}
152+
return true;
153+
}
154+
155+
template <typename T>
156+
bool strategySelectionPID(const T& candidate, int PID, int strategy)
157+
{
158+
if (PID == 0) {
159+
if (strategy == 0) {
160+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
161+
return true;
162+
}
163+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
164+
return true;
165+
}
166+
} else if (strategy == 1) {
167+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
168+
return true;
169+
}
170+
if (candidate.pt() >= 0.5 && std::sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
171+
return true;
172+
}
173+
} else if (strategy == 2) {
174+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
175+
return true;
176+
}
177+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
178+
return true;
179+
}
180+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) {
181+
return true;
182+
}
183+
}
184+
}
185+
if (PID == 1) {
186+
if (strategy == 0) {
187+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
188+
return true;
189+
}
190+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
191+
return true;
192+
}
193+
} else if (strategy == 1) {
194+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
195+
return true;
196+
}
197+
if (candidate.pt() >= 0.5 && std::sqrt(candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
198+
return true;
199+
}
200+
} else if (strategy == 2) {
201+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
202+
return true;
203+
}
204+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
205+
return true;
206+
}
207+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) {
208+
return true;
209+
}
210+
}
211+
}
212+
return false;
213+
}
214+
215+
double getPhiInRange(double phi)
216+
{
217+
double pi = o2::constants::math::PI;
218+
double twoPi = 2.0 * pi;
219+
double result = phi;
220+
// Normalize to [-pi, pi]
221+
// double result = std::fmod(phi + pi, twoPi);
222+
// if (result < 0) {
223+
// result += twoPi;
224+
// }
225+
// result -= pi; // Now result is in [-pi, pi]
226+
227+
// Convert from [-pi, pi] to [0, pi]
228+
if (result < 0) {
229+
result += pi; // Shift negative values to positive
230+
}
231+
232+
// If phi > 2π, subtract π instead of normalizing by 2π
233+
if (phi > twoPi) {
234+
result -= pi;
235+
}
236+
237+
return result; // Ensures range is [0, π]
238+
}
239+
240+
template <typename T>
241+
bool isFakeKaon(T const& track, int /*PID*/)
242+
{
243+
const auto pglobal = track.p();
244+
const auto ptpc = track.tpcInnerParam();
245+
if (std::abs(pglobal - ptpc) > confFakeKaonCut) {
246+
return true;
247+
}
248+
return false;
249+
}
250+
251+
ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, kaonrot, kstarrot;
252+
253+
void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&)
254+
{
255+
if (!collision.sel8() || !collision.triggereventsp() || !collision.selection_bit(aod::evsel::kNoTimeFrameBorder) || !collision.selection_bit(aod::evsel::kNoITSROFrameBorder) || !collision.selection_bit(aod::evsel::kNoSameBunchPileup) || !collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
256+
return;
257+
}
258+
auto centrality = collision.centFT0C();
259+
260+
auto qxZDCA = collision.qxZDCA();
261+
auto qxZDCC = collision.qxZDCC();
262+
auto qyZDCA = collision.qyZDCA();
263+
auto qyZDCC = collision.qyZDCC();
264+
265+
auto proQxtQxp = qxZDCA * qxZDCC;
266+
auto proQytQyp = qyZDCA * qyZDCC;
267+
auto proQxytp = proQxtQxp + proQytQyp;
268+
auto proQxpQyt = qxZDCA * qyZDCC;
269+
auto proQxtQyp = qxZDCC * qyZDCA;
270+
271+
histos.fill(HIST("hpQxtQxpvscent"), centrality, proQxtQxp);
272+
histos.fill(HIST("hpQytQypvscent"), centrality, proQytQyp);
273+
histos.fill(HIST("hpQxytpvscent"), centrality, proQxytp);
274+
histos.fill(HIST("hpQxpQytvscent"), centrality, proQxpQyt);
275+
histos.fill(HIST("hpQxtQypvscent"), centrality, proQxtQyp);
276+
277+
for (const auto& track1 : tracks) {
278+
if (!selectionTrack(track1)) {
279+
continue;
280+
}
281+
bool track1kaon = false;
282+
auto track1ID = track1.globalIndex();
283+
if (!strategySelectionPID(track1, 0, strategyPID)) {
284+
continue;
285+
}
286+
track1kaon = true;
287+
for (const auto& track2 : tracks) {
288+
if (!selectionTrack(track2)) {
289+
continue;
290+
}
291+
bool track2pion = false;
292+
auto track2ID = track2.globalIndex();
293+
if (!strategySelectionPID(track2, 1, strategyPID)) {
294+
continue;
295+
}
296+
track2pion = true;
297+
if (track2ID == track1ID) {
298+
continue;
299+
}
300+
if (!track1kaon || !track2pion) {
301+
continue;
302+
}
303+
daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
304+
daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi);
305+
KstarMother = daughter1 + daughter2;
306+
if (std::abs(KstarMother.Rapidity()) > 0.9) {
307+
continue;
308+
}
309+
310+
// // constrain angle to 0 -> [0,0+2pi]
311+
// auto phi = RecoDecay::constrainAngle(KstarMother.Phi(), 0,o2::constants::math::TwoPI);
312+
313+
auto ux = std::cos(getPhiInRange(KstarMother.Phi()));
314+
auto uy = std::sin(getPhiInRange(KstarMother.Phi()));
315+
auto v1 = ux * (qxZDCA - qxZDCC) + uy * (qyZDCA - qyZDCC);
316+
317+
// unlike sign
318+
if (track1.sign() * track2.sign() < 0) {
319+
histos.fill(HIST("hpv1vscentpteta"), KstarMother.M(), centrality, KstarMother.Pt(), KstarMother.Rapidity(), v1);
320+
if (fillRotation) {
321+
for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) {
322+
auto anglestart = confMinRot;
323+
auto angleend = confMaxRot;
324+
auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1));
325+
auto rotangle = anglestart + nrotbkg * anglestep;
326+
auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle);
327+
auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle);
328+
kaonrot = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa);
329+
kstarrot = kaonrot + daughter2;
330+
331+
if (std::abs(kstarrot.Rapidity()) > 0.9) {
332+
continue;
333+
}
334+
335+
auto uxrot = std::cos(getPhiInRange(KstarMother.Phi()));
336+
auto uyrot = std::sin(getPhiInRange(KstarMother.Phi()));
337+
338+
auto v1rot = uxrot * (qxZDCA - qxZDCC) + uyrot * (qyZDCA - qyZDCC);
339+
340+
histos.fill(HIST("hpv1vscentptetarot"), kstarrot.M(), centrality, kstarrot.Pt(), kstarrot.Rapidity(), v1rot);
341+
}
342+
}
343+
}
344+
// like sign
345+
if (track1.sign() * track2.sign() > 0) {
346+
histos.fill(HIST("hpv1vscentptetalike"), kstarrot.M(), centrality, kstarrot.Pt(), kstarrot.Rapidity(), v1);
347+
}
348+
}
349+
}
350+
}
351+
PROCESS_SWITCH(KstarFlowv1, processSE, "Process Same event", true);
352+
};
353+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
354+
{
355+
return WorkflowSpec{adaptAnalysisTask<KstarFlowv1>(cfgc)};
356+
}

0 commit comments

Comments
 (0)