Skip to content

Commit 67ecdd5

Browse files
authored
[PWGCF] [PWGCF]Add files for ese calculation (#11890)
1 parent 38de5d1 commit 67ecdd5

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed

PWGCF/Flow/Tasks/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,8 @@ o2physics_add_dpl_workflow(flow-ese-p-he3
8383
SOURCES flowEsePHe3.cxx
8484
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore
8585
COMPONENT_NAME Analysis)
86+
87+
o2physics_add_dpl_workflow(flow-ese-task
88+
SOURCES flowEseTask.cxx
89+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::GFWCore
90+
COMPONENT_NAME Analysis)

PWGCF/Flow/Tasks/flowEseTask.cxx

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
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 flowEseTask.cxx
13+
/// \brief Task for flow and event shape engineering correlation with other observation.
14+
/// \author Alice Collaboration
15+
/// \since 2023-05-15
16+
/// \version 1.0
17+
///
18+
/// This task calculates flow and event shape engineering
19+
/// using Q-vector and event plane methods.
20+
21+
// C++/ROOT includes.
22+
#include <TComplex.h>
23+
#include <TH1F.h>
24+
#include <TH2D.h>
25+
#include <TMath.h>
26+
#include <TVector2.h>
27+
28+
#include <chrono>
29+
#include <string>
30+
#include <vector>
31+
32+
// o2Physics includes.
33+
#include "Common/Core/EventPlaneHelper.h"
34+
#include "Common/Core/TrackSelection.h"
35+
#include "Common/DataModel/Centrality.h"
36+
#include "Common/DataModel/EventSelection.h"
37+
#include "Common/DataModel/Qvectors.h"
38+
#include "Common/DataModel/TrackSelectionTables.h"
39+
40+
#include "CommonConstants/PhysicsConstants.h"
41+
#include "Framework/ASoAHelpers.h"
42+
#include "Framework/AnalysisDataModel.h"
43+
#include "Framework/AnalysisTask.h"
44+
#include "Framework/HistogramRegistry.h"
45+
#include "Framework/RunningWorkflowInfo.h"
46+
#include "Framework/StaticFor.h"
47+
#include "Framework/runDataProcessing.h"
48+
49+
// o2 includes.
50+
51+
using namespace o2;
52+
using namespace o2::framework;
53+
54+
using MyCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs, aod::CentFV0As, aod::QvectorFT0CVecs, aod::QvectorTPCposVecs, aod::QvectorTPCnegVecs>;
55+
using MyTracks = soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TrackSelectionExtension>;
56+
using BCsWithRun3Matchings = soa::Join<aod::BCs, aod::Timestamps, aod::Run3MatchedToBCSparse>;
57+
58+
struct FlowEseTask {
59+
HistogramRegistry histosQA{"histosQA", {}, OutputObjHandlingPolicy::AnalysisObject, false, false};
60+
61+
Configurable<std::vector<int>> cfgNmods{"cfgNmods", {2}, "Modulation of interest"};
62+
Configurable<std::string> cfgDetName{"cfgDetName", "FT0C", "The name of detector to be analyzed"};
63+
Configurable<std::string> cfgRefAName{"cfgRefAName", "TPCpos", "The name of detector for reference A"};
64+
Configurable<std::string> cfgRefBName{"cfgRefBName", "TPCneg", "The name of detector for reference B"};
65+
66+
Configurable<float> cfgMinPt{"cfgMinPt", 0.15f, "Minimum transverse momentum for charged track"};
67+
Configurable<float> cfgMaxEta{"cfgMaxEta", 0.8f, "Maximum pseudorapidiy for charged track"};
68+
Configurable<float> cfgMaxDCArToPVcut{"cfgMaxDCArToPVcut", 0.1f, "Maximum transverse DCA"};
69+
Configurable<float> cfgMaxDCAzToPVcut{"cfgMaxDCAzToPVcut", 1.0f, "Maximum longitudinal DCA"};
70+
71+
ConfigurableAxis cfgAxisQvecF{"cfgAxisQvecF", {300, -1, 1}, ""};
72+
ConfigurableAxis cfgAxisQvec{"cfgAxisQvec", {100, -3, 3}, ""};
73+
ConfigurableAxis cfgAxisCent{"cfgAxisCent", {100, 0, 100}, ""};
74+
75+
ConfigurableAxis cfgAxisCos{"cfgAxisCos", {102, -1.02, 1.02}, ""};
76+
ConfigurableAxis cfgAxisPt{"cfgAxisPt", {100, 0, 10}, ""};
77+
ConfigurableAxis cfgAxisCentMerged{"cfgAxisCentMerged", {20, 0, 100}, ""};
78+
ConfigurableAxis cfgAxisMultNum{"cfgAxisMultNum", {300, 0, 2700}, ""};
79+
ConfigurableAxis cfgaxisQ{"cfgaxisQ", {1000, 0, 1000}, ""};
80+
81+
static constexpr float kMinAmplitudeThreshold = 1e-4f;
82+
static constexpr int kDefaultModulation = 2;
83+
84+
EventPlaneHelper helperEP;
85+
86+
void init(InitContext const&)
87+
{
88+
AxisSpec axisCent{cfgAxisCent, "centrality"};
89+
AxisSpec axisQvec{cfgAxisQvec, "Q"};
90+
AxisSpec axisQvecF{cfgAxisQvecF, "Q"};
91+
AxisSpec axisEvtPl = {100, -1.0 * constants::math::PI, constants::math::PI};
92+
93+
AxisSpec axisCos{cfgAxisCos, "angle function"};
94+
AxisSpec axisPt{cfgAxisPt, "trasverse momentum"};
95+
AxisSpec axisCentMerged{cfgAxisCentMerged, "merged centrality"};
96+
AxisSpec axisMultNum{cfgAxisMultNum, "statistic of mult"};
97+
AxisSpec axisQ{cfgaxisQ, "result of q2"};
98+
99+
histosQA.add(Form("histQvecV2"), "", {HistType::kTH3F, {axisQvecF, axisQvecF, axisCent}});
100+
histosQA.add(Form("histQvecCent"), "", {HistType::kTH2F, {axisQ, axisCent}});
101+
histosQA.add(Form("histEvtPlV2"), "", {HistType::kTH2F, {axisEvtPl, axisCent}});
102+
histosQA.add(Form("histQvecRes_SigRefAV2"), "", {HistType::kTH2F, {axisQvecF, axisCent}});
103+
histosQA.add(Form("histCosDetV2"), "", {HistType::kTH3F, {axisCentMerged, axisPt, axisCos}});
104+
histosQA.add(Form("histMult_Cent"), "", {HistType::kTH2F, {axisMultNum, axisCent}});
105+
}
106+
107+
template <typename CollType>
108+
bool selectEvent(CollType const& collision)
109+
{
110+
if (!collision.sel8()) {
111+
return false;
112+
}
113+
if (!collision.selection_bit(aod::evsel::kIsGoodZvtxFT0vsPV)) {
114+
return false;
115+
}
116+
if (!collision.selection_bit(aod::evsel::kNoSameBunchPileup)) {
117+
return false;
118+
}
119+
if (!collision.selection_bit(o2::aod::evsel::kNoCollInTimeRangeStandard)) {
120+
return false;
121+
}
122+
123+
return true;
124+
}
125+
126+
template <typename TrackType>
127+
bool selectTrack(TrackType const& track)
128+
{
129+
if (track.pt() < cfgMinPt) {
130+
return false;
131+
}
132+
if (std::abs(track.eta()) > cfgMaxEta) {
133+
return false;
134+
}
135+
if (!track.passedITSNCls()) {
136+
return false;
137+
}
138+
if (!track.passedITSChi2NDF()) {
139+
return false;
140+
}
141+
if (!track.passedITSHits()) {
142+
return false;
143+
}
144+
if (!track.passedTPCCrossedRowsOverNCls()) {
145+
return false;
146+
}
147+
if (!track.passedTPCChi2NDF()) {
148+
return false;
149+
}
150+
if (!track.passedDCAxy()) {
151+
return false;
152+
}
153+
if (!track.passedDCAz()) {
154+
return false;
155+
}
156+
157+
return true;
158+
}
159+
160+
template <typename CollType>
161+
void fillHistosQvec(CollType const& collision, int nmode)
162+
{
163+
if (nmode == kDefaultModulation) {
164+
histosQA.fill(HIST("histQvecV2"), collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0],
165+
collision.centFT0C());
166+
histosQA.fill(HIST("histQvecCent"), std::sqrt(collision.qvecFT0CReVec()[0] * collision.qvecFT0CReVec()[0] + collision.qvecFT0CImVec()[0] * collision.qvecFT0CImVec()[0]) * std::sqrt(collision.sumAmplFT0C()), collision.centFT0C());
167+
histosQA.fill(HIST("histEvtPlV2"),
168+
helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode),
169+
collision.centFT0C());
170+
histosQA.fill(HIST("histQvecRes_SigRefAV2"), helperEP.GetResolution(helperEP.GetEventPlane(collision.qvecFT0CReVec()[0], collision.qvecFT0CImVec()[0], nmode), helperEP.GetEventPlane(collision.qvecTPCposReVec()[0], collision.qvecTPCposImVec()[0], nmode), nmode),
171+
collision.centFT0C());
172+
histosQA.fill(HIST("histMult_Cent"), collision.sumAmplFT0C(), collision.centFT0C());
173+
}
174+
}
175+
176+
template <typename CollType, typename TrackType>
177+
void fillHistosFlow(CollType const& collision, TrackType const& tracks, int nmode)
178+
{
179+
if (collision.sumAmplFT0C() < kMinAmplitudeThreshold) {
180+
return;
181+
}
182+
for (auto const& trk : tracks) {
183+
if (!selectTrack(trk)) {
184+
continue;
185+
}
186+
if (nmode == kDefaultModulation) {
187+
histosQA.fill(HIST("histCosDetV2"), collision.centFT0C(), trk.pt(),
188+
std::cos(static_cast<float>(nmode) * (trk.phi() -
189+
helperEP.GetEventPlane(collision.qvecFT0CReVec()[0],
190+
collision.qvecFT0CImVec()[0],
191+
nmode))));
192+
}
193+
}
194+
}
195+
196+
void process(MyCollisions::iterator const& collision, MyTracks const& tracks)
197+
{
198+
if (!selectEvent(collision)) {
199+
return;
200+
}
201+
for (std::size_t i = 0; i < cfgNmods->size(); i++) {
202+
fillHistosQvec(collision, cfgNmods->at(i));
203+
fillHistosFlow(collision, tracks, cfgNmods->at(i));
204+
}
205+
}
206+
};
207+
208+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
209+
{
210+
return WorkflowSpec{
211+
adaptAnalysisTask<FlowEseTask>(cfgc)};
212+
}

0 commit comments

Comments
 (0)