Skip to content

Commit 2f476ae

Browse files
committed
PWGLF: Initial task for first-order flow harmonics of K*(892)
1 parent a8f9d51 commit 2f476ae

File tree

2 files changed

+374
-0
lines changed

2 files changed

+374
-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(kstarflowv1
193+
SOURCES kstarflowv1.cxx
194+
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore
195+
COMPONENT_NAME Analysis)
Lines changed: 369 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,369 @@
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 <[email protected]>, Dukhishyam Mallick <[email protected]>
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+
126+
void init(o2::framework::InitContext&)
127+
{
128+
AxisSpec spAxis = {spNbins, lbinsp, hbinsp, "Sp"};
129+
130+
histos.add("hpQxtQxpvscent", "hpQxtQxpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
131+
histos.add("hpQytQypvscent", "hpQytQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
132+
histos.add("hpQxytpvscent", "hpQxytpvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
133+
histos.add("hpQxtQypvscent", "hpQxtQypvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
134+
histos.add("hpQxpQytvscent", "hpQxpQytvscent", HistType::kTHnSparseF, {configcentAxis, spAxis}, true);
135+
136+
histos.add("hpv1vscentpteta", "hpv1vscentpteta", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
137+
histos.add("hpv1vscentptetarot", "hpv1vscentptetarot", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
138+
histos.add("hpv1vscentptetalike", "hpv1vscentptetalike", HistType::kTHnSparseF, {configIMAxis, configcentAxis, configthnAxisPt, configetaAxis, spAxis}, true);
139+
}
140+
141+
142+
double massKa = o2::constants::physics::MassKPlus;
143+
double massPi = o2::constants::physics::MassPiMinus;
144+
145+
146+
template <typename T>
147+
bool selectionTrack(const T& candidate)
148+
{
149+
if (useGlobalTrack && !(candidate.isGlobalTrack() && candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster && candidate.tpcNClsFound() > cfgTPCcluster)) {
150+
return false;
151+
}
152+
if (!useGlobalTrack && !(candidate.isPVContributor() && candidate.itsNCls() > cfgITScluster)) {
153+
return false;
154+
}
155+
return true;
156+
}
157+
158+
159+
template <typename T>
160+
bool strategySelectionPID(const T& candidate, int PID, int strategy)
161+
{
162+
if (PID == 0) {
163+
if (strategy == 0) {
164+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
165+
return true;
166+
}
167+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
168+
return true;
169+
}
170+
} else if (strategy == 1) {
171+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
172+
return true;
173+
}
174+
if (candidate.pt() >= 0.5 && std::sqrt(candidate.tpcNSigmaKa() * candidate.tpcNSigmaKa() + candidate.tofNSigmaKa() * candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
175+
return true;
176+
}
177+
} else if (strategy == 2) {
178+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC) {
179+
return true;
180+
}
181+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaKa()) < nsigmaCutTOF && candidate.beta() > 0.5) {
182+
return true;
183+
}
184+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaKa()) < nsigmaCutTPC && !candidate.hasTOF()) {
185+
return true;
186+
}
187+
}
188+
}
189+
if (PID == 1) {
190+
if (strategy == 0) {
191+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
192+
return true;
193+
}
194+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
195+
return true;
196+
}
197+
} else if (strategy == 1) {
198+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
199+
return true;
200+
}
201+
if (candidate.pt() >= 0.5 && std::sqrt(candidate.tpcNSigmaPi() * candidate.tpcNSigmaPi() + candidate.tofNSigmaPi() * candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
202+
return true;
203+
}
204+
} else if (strategy == 2) {
205+
if (candidate.pt() < 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC) {
206+
return true;
207+
}
208+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && candidate.hasTOF() && std::abs(candidate.tofNSigmaPi()) < nsigmaCutTOF && candidate.beta() > 0.5) {
209+
return true;
210+
}
211+
if (candidate.pt() >= 0.5 && std::abs(candidate.tpcNSigmaPi()) < nsigmaCutTPC && !candidate.hasTOF()) {
212+
return true;
213+
}
214+
}
215+
}
216+
return false;
217+
}
218+
219+
double getPhiInRange(double phi)
220+
{
221+
double pi = o2::constants::math::PI;
222+
double twoPi = 2.0 * pi;
223+
double result = phi;
224+
// Normalize to [-pi, pi]
225+
// double result = std::fmod(phi + pi, twoPi);
226+
// if (result < 0) {
227+
// result += twoPi;
228+
// }
229+
//result -= pi; // Now result is in [-pi, pi]
230+
231+
// Convert from [-pi, pi] to [0, pi]
232+
if (result < 0) {
233+
result += pi; // Shift negative values to positive
234+
}
235+
236+
// If phi > 2π, subtract π instead of normalizing by 2π
237+
if (phi > twoPi) {
238+
result -= pi;
239+
}
240+
241+
return result; // Ensures range is [0, π]
242+
}
243+
244+
245+
246+
247+
template <typename T>
248+
bool isFakeKaon(T const& track, int /*PID*/)
249+
{
250+
const auto pglobal = track.p();
251+
const auto ptpc = track.tpcInnerParam();
252+
if (std::abs(pglobal - ptpc) > confFakeKaonCut) {
253+
return true;
254+
}
255+
return false;
256+
}
257+
258+
ROOT::Math::PxPyPzMVector KstarMother, daughter1, daughter2, kaonrot, kstarrot;
259+
260+
void processSE(EventCandidates::iterator const& collision, TrackCandidates const& tracks, aod::BCs const&)
261+
{
262+
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)) {
263+
return;
264+
}
265+
auto centrality = collision.centFT0C();
266+
267+
268+
auto qxZDCA = collision.qxZDCA();
269+
auto qxZDCC = collision.qxZDCC();
270+
auto qyZDCA = collision.qyZDCA();
271+
auto qyZDCC = collision.qyZDCC();
272+
auto psiZDCC = collision.psiZDCC();
273+
auto psiZDCA = collision.psiZDCA();
274+
275+
276+
auto proQxtQxp = qxZDCA * qxZDCC;
277+
auto proQytQyp = qyZDCA * qyZDCC;
278+
auto proQxytp = proQxtQxp + proQytQyp;
279+
auto proQxpQyt = qxZDCA * qyZDCC;
280+
auto proQxtQyp = qxZDCC * qyZDCA;
281+
282+
histos.fill(HIST("hpQxtQxpvscent"), centrality, proQxtQxp);
283+
histos.fill(HIST("hpQytQypvscent"), centrality, proQytQyp);
284+
histos.fill(HIST("hpQxytpvscent"), centrality, proQxytp);
285+
histos.fill(HIST("hpQxpQytvscent"), centrality, proQxpQyt);
286+
histos.fill(HIST("hpQxtQypvscent"), centrality, proQxtQyp);
287+
288+
289+
for (const auto& track1 : tracks) {
290+
if (!selectionTrack(track1)) {
291+
continue;
292+
}
293+
bool track1kaon = false;
294+
auto track1ID = track1.globalIndex();
295+
if (!strategySelectionPID(track1, 0, strategyPID)) {
296+
continue;
297+
}
298+
track1kaon = true;
299+
for (const auto& track2 : tracks) {
300+
if (!selectionTrack(track2)) {
301+
continue;
302+
}
303+
bool track2pion = false;
304+
auto track2ID = track2.globalIndex();
305+
if (!strategySelectionPID(track2, 1, strategyPID)) {
306+
continue;
307+
}
308+
track2pion = true;
309+
if (track2ID == track1ID) {
310+
continue;
311+
}
312+
if (!track1kaon || !track2pion) {
313+
continue;
314+
}
315+
daughter1 = ROOT::Math::PxPyPzMVector(track1.px(), track1.py(), track1.pz(), massKa);
316+
daughter2 = ROOT::Math::PxPyPzMVector(track2.px(), track2.py(), track2.pz(), massPi);
317+
KstarMother = daughter1 + daughter2;
318+
if (std::abs(KstarMother.Rapidity()) > 0.9) {
319+
continue;
320+
}
321+
322+
// // constrain angle to 0 -> [0,0+2pi]
323+
// auto phi = RecoDecay::constrainAngle(KstarMother.Phi(), 0,o2::constants::math::TwoPI);
324+
325+
auto ux = std::cos(getPhiInRange(KstarMother.Phi()));
326+
auto uy = std::sin(getPhiInRange(KstarMother.Phi()));
327+
auto v1 = ux * (qxZDCA - qxZDCC) + uy * (qyZDCA - qyZDCC);
328+
329+
// unlike sign
330+
if (track1.sign() * track2.sign() < 0) {
331+
histos.fill(HIST("hpv1vscentpteta"), KstarMother.M(), centrality, KstarMother.Pt(), KstarMother.Rapidity(), v1);
332+
if (fillRotation) {
333+
for (int nrotbkg = 0; nrotbkg < nBkgRotations; nrotbkg++) {
334+
auto anglestart = confMinRot;
335+
auto angleend = confMaxRot;
336+
auto anglestep = (angleend - anglestart) / (1.0 * (nBkgRotations - 1));
337+
auto rotangle = anglestart + nrotbkg * anglestep;
338+
auto rotkaonPx = track1.px() * std::cos(rotangle) - track1.py() * std::sin(rotangle);
339+
auto rotkaonPy = track1.px() * std::sin(rotangle) + track1.py() * std::cos(rotangle);
340+
kaonrot = ROOT::Math::PxPyPzMVector(rotkaonPx, rotkaonPy, track1.pz(), massKa);
341+
kstarrot = kaonrot + daughter2;
342+
343+
if (std::abs(kstarrot.Rapidity()) > 0.9) {
344+
continue;
345+
}
346+
347+
auto uxrot = std::cos(getPhiInRange(KstarMother.Phi()));
348+
auto uyrot = std::sin(getPhiInRange(KstarMother.Phi()));
349+
350+
auto v1rot = uxrot * (qxZDCA - qxZDCC) + uyrot * (qyZDCA - qyZDCC);
351+
352+
histos.fill(HIST("hpv1vscentptetarot"), kstarrot.M(), centrality, kstarrot.Pt(), kstarrot.Rapidity(), v1rot);
353+
}
354+
}
355+
}
356+
// like sign
357+
if (track1.sign() * track2.sign() > 0) {
358+
histos.fill(HIST("hpv1vscentptetalike"), kstarrot.M(), centrality, kstarrot.Pt(), kstarrot.Rapidity(), v1);
359+
}
360+
}
361+
}
362+
}
363+
PROCESS_SWITCH(KstarFlowv1, processSE, "Process Same event", true);
364+
};
365+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
366+
{
367+
return WorkflowSpec{adaptAnalysisTask<KstarFlowv1>(cfgc)};
368+
}
369+

0 commit comments

Comments
 (0)