Skip to content

Commit 00bab6b

Browse files
authored
PWGCF: EbyE Intermittency analysis (#5309)
* firstcommit firstcommit1 inprogress inprogress2 inprogress3 rebased_branch final_commit * linter_fix * chgdimpl
1 parent e937b61 commit 00bab6b

2 files changed

Lines changed: 314 additions & 1 deletion

File tree

PWGCF/EbyEFluctuations/Tasks/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,9 @@ o2physics_add_dpl_workflow(robust-fluctuation-observables
3737
o2physics_add_dpl_workflow(v0pt-pp-task
3838
SOURCES Diff_pT_fluct_PID.cxx
3939
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore
40-
COMPONENT_NAME Analysis)
40+
COMPONENT_NAME Analysis)
41+
42+
o2physics_add_dpl_workflow(factorial-moments
43+
SOURCES FactorialMomentsTask.cxx
44+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::PWGCFCore
45+
COMPONENT_NAME Analysis)
Lines changed: 308 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,308 @@
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+
/// \brief This task is for Normalized Factorial Moments Analysis: PRC 85, 044914 (2012), nucl-ex:1411.6083
13+
/// \author Salman Malik
14+
/// \author Balwan Singh
15+
16+
#include <iostream>
17+
#include <array>
18+
#include <TH1F.h>
19+
// O2 includes
20+
#include "Framework/AnalysisDataModel.h"
21+
#include "Framework/AnalysisTask.h"
22+
#include "Framework/runDataProcessing.h"
23+
#include "Common/DataModel/Multiplicity.h"
24+
#include "Common/DataModel/EventSelection.h"
25+
#include "Common/DataModel/Centrality.h"
26+
#include "Common/Core/TrackSelection.h"
27+
#include "Common/DataModel/TrackSelectionTables.h"
28+
#include "ReconstructionDataFormats/GlobalTrackID.h"
29+
#include "ReconstructionDataFormats/Track.h"
30+
#include "Framework/ASoAHelpers.h"
31+
32+
using std::array;
33+
using namespace o2;
34+
using namespace o2::framework;
35+
using namespace o2::framework::expressions;
36+
37+
struct FactorialMoments {
38+
39+
Configurable<Float_t> confEta{"centralEta", 0.8, "eta limit for tracks"};
40+
Configurable<Int_t> confNumPt{"numPt", 1, "number of pT bins"};
41+
Configurable<Float_t> confPtMin{"ptMin", 0.2f, "lower pT cut"};
42+
Configurable<Float_t> confDCAxy{"dcaXY", 2.4f, "DCA xy cut"};
43+
Configurable<Float_t> confDCAz{"dcaZ", 3.2f, "DCA z cut"};
44+
Configurable<Float_t> confMinTPCCls{"minTPCCls", 70.0f, "minimum number of TPC clusters"};
45+
Configurable<std::vector<Int_t>> confCentCut{"centLimits", {0, 5}, "centrality min and max"};
46+
Configurable<std::vector<Float_t>> confVertex{"vertexXYZ", {0.3f, 0.4f, 10.0f}, "vertex cuts"};
47+
Configurable<std::vector<Float_t>> confPtBins{"ptCuts", {0.2f, 2.0f}, "pT cuts"};
48+
49+
Filter filterTracks = (nabs(aod::track::eta) < confEta) && (aod::track::pt >= confPtMin) && (nabs(aod::track::dcaXY) < confDCAxy) && (nabs(aod::track::dcaZ) < confDCAz);
50+
Filter filterCollisions = (nabs(aod::collision::posZ) < confVertex.value[2]) && (nabs(aod::collision::posX) < confVertex.value[0]) && (nabs(aod::collision::posY) < confVertex.value[1]);
51+
52+
// Histograms
53+
HistogramRegistry histos{
54+
"histos",
55+
{
56+
{"mCollID", "collisionID", {HistType::kTH1I, {{1000, -10000, 10000}}}},
57+
{"mCentFT0M", "centFT0C_0A", {HistType::kTH1F, {{100, 0, 100}}}},
58+
{"mCentFV0A", "centFV0A", {HistType::kTH1F, {{100, 0, 100}}}},
59+
{"mCentFT0A", "centFT0A", {HistType::kTH1F, {{100, 0, 100}}}},
60+
{"mCentFT0C", "centFT0C", {HistType::kTH1F, {{100, 0, 100}}}},
61+
{"mVertexX", "vertexX", {HistType::kTH1F, {{100, -20, 20}}}},
62+
{"mVertexY", "vertexY", {HistType::kTH1F, {{100, -20, 20}}}},
63+
{"mVertexZ", "vertexZ", {HistType::kTH1F, {{100, -20, 20}}}},
64+
{"mEta", "#eta", {HistType::kTH1F, {{1000, -2, 2}}}},
65+
{"mPt", "#pt", {HistType::kTH1F, {{1000, -0.01, 50}}}},
66+
{"mPhi", "#phi", {HistType::kTH1F, {{100, 0, TMath::TwoPi()}}}},
67+
{"mEvents", "events", {HistType::kTH1D, {{5, -0.5, 4.5}}}},
68+
{"mNFindableClsTPC", "findable TPC clusters;findable clusters", {HistType::kTH1F, {{100, 0, 200}}}},
69+
{"mNClsTPC", "number of clusters TPC; nClusters TPC", {HistType::kTH1F, {{100, 0, 200}}}},
70+
{"mNClsITS", "number of clusters ITS; nClusters ITS", {HistType::kTH1F, {{100, 0, 10}}}},
71+
{"mChi2TPC", "chi2 TPC", {HistType::kTH1F, {{100, 0, 10}}}},
72+
{"mChi2ITS", "chi2 ITS", {HistType::kTH1F, {{100, 0, 10}}}},
73+
{"mChi2TRD", "chi2 TRD", {HistType::kTH1F, {{100, 0, 100}}}},
74+
{"mDCAxy", "DCA xy", {HistType::kTH1F, {{100, -0.8, 0.8}}}},
75+
{"mDCAx", "DCA z", {HistType::kTH1F, {{100, -2.0, 2.0}}}},
76+
{"mDCAxyPt", "DCA xy vs #pt;#pt;DCAxy", {HistType::kTH2F, {{100, 0, 20}, {100, -0.5, 0.5}}}},
77+
{"mDCAzPt", "DCA z vs #pt;#pt;DCAz", {HistType::kTH2F, {{100, 0, 20}, {100, -2.0, 2.0}}}},
78+
{"mNSharedClsTPC", "shared clusters in TPC", {HistType::kTH1F, {{100, 0, 10}}}},
79+
{"mCrossedRowsTPC", "crossedrows in TPC", {HistType::kTH1F, {{100, 0, 200}}}},
80+
{"mNFinClsminusCRows", "findable cluster #minus crossed rows (TPC)", {HistType::kTH1F, {{100, 0, 200}}}},
81+
{"mNFractionShClsTPC", "fraction of shared clusters in TPC", {HistType::kTH1F, {{100, 0, 2}}}},
82+
{"mSharedClsvsPt", "shared cluster vs #pt", {HistType::kTH2F, {{100, 0, 50}, {100, 0, 10}}}},
83+
{"mSharedClsProbvsPt", "shared clusters ration vs #pt;#pt;sharedcls/ncrows", {HistType::kTH2F, {{100, 0, 50}, {100, 0, 5}}}},
84+
},
85+
OutputObjHandlingPolicy::AnalysisObject,
86+
true};
87+
static const Int_t nBins = 52;
88+
array<Int_t, nBins> binningM;
89+
array<Int_t, 5> countTracks{0, 0, 0, 0, 0};
90+
array<array<array<Double_t, nBins>, 5>, 6> fqEvent;
91+
array<array<Double_t, nBins>, 5> binConEvent;
92+
std::vector<std::shared_ptr<TH2>> mHistArrReset;
93+
std::vector<std::shared_ptr<TH1>> mHistArrQA;
94+
std::vector<std::shared_ptr<TH1>> mFqBinFinal;
95+
std::vector<std::shared_ptr<TH1>> mBinConFinal;
96+
// max number of bins restricted to 5
97+
static constexpr array<std::string_view, 5> mbinNames{"bin1/", "bin2/", "bin3/", "bin4/", "bin5/"};
98+
99+
void init(o2::framework::InitContext&)
100+
{
101+
// NOTE: check to make number of pt and the vector consistent
102+
if (confNumPt != static_cast<int>(confPtBins.value.size()) / 2) {
103+
for (int i = confNumPt; i < static_cast<int>(confPtBins.value.size() / 2); i++) {
104+
confPtBins.value[2 * i] = 0;
105+
confPtBins.value[2 * i + 1] = 0;
106+
}
107+
}
108+
AxisSpec axisPt[5] = {{100, -0.01, 3 * confPtBins.value[1], ""}, {100, -0.01, 3 * confPtBins.value[3], ""}, {100, -0.01, 3 * confPtBins.value[5], ""}, {100, -0.01, 3 * confPtBins.value[7], ""}, {100, -0.01, 3 * confPtBins.value[9], ""}}; // pT axis
109+
110+
for (auto iM = 0; iM < nBins; ++iM) {
111+
binningM[iM] = 2 * (iM + 2);
112+
}
113+
for (auto iPt = 0; iPt < confNumPt; ++iPt) {
114+
mHistArrQA.push_back(std::get<std::shared_ptr<TH1>>(histos.add(Form("bin%i/mEta", iPt + 1), Form("#eta for bin %.2f-%.2f;#eta", confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {{1000, -2, 2}})));
115+
mHistArrQA.push_back(std::get<std::shared_ptr<TH1>>(histos.add(Form("bin%i/mPt", iPt + 1), Form("pT for bin %.2f-%.2f;pT", confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {axisPt[iPt]})));
116+
mHistArrQA.push_back(std::get<std::shared_ptr<TH1>>(histos.add(Form("bin%i/mPhi", iPt + 1), Form("#phi for bin %.2f-%.2f;#phi", confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {{1000, 0, 2 * TMath::Pi()}})));
117+
mHistArrQA.push_back(std::get<std::shared_ptr<TH1>>(histos.add(Form("bin%i/mMultiplicity", iPt + 1), Form("Multiplicity for bin %.2f-%.2f;Multiplicity", confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {{1000, 0, 8000}})));
118+
for (auto iM = 0; iM < nBins; ++iM) {
119+
auto mHistsR = std::get<std::shared_ptr<TH2>>(histos.add(Form("bin%i/Reset/mEtaPhi%i", iPt + 1, iM), Form("#eta#phi_%i for bin %.2f-%.2f;#eta;#phi", iM, confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH2F, {{binningM[iM], -0.8, 0.8}, {binningM[iM], 0, 2 * TMath::Pi()}}));
120+
mHistArrReset.push_back(mHistsR);
121+
}
122+
for (auto i = 0; i < 6; ++i) {
123+
auto mHistFq = std::get<std::shared_ptr<TH1>>(histos.add(Form("mFinalFq%i_bin%i", i + 2, iPt + 1), Form("Final F_%i for bin %.2f-%.2f;M", i + 2, confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {{nBins, -0.5, nBins - 0.5}}));
124+
mFqBinFinal.push_back(mHistFq);
125+
auto mHistAv = std::get<std::shared_ptr<TH1>>(histos.add(Form("mFinalAvBin%i_bin%i", i + 2, iPt + 1), Form("Final AvBin_%i for bin %.2f-%.2f;M", i + 2, confPtBins.value[2 * iPt], confPtBins.value[2 * iPt + 1]), HistType::kTH1F, {{nBins, -0.5, nBins - 0.5}}));
126+
mBinConFinal.push_back(mHistAv);
127+
}
128+
}
129+
}
130+
131+
template <class T>
132+
void checkpT(const T& track)
133+
{
134+
for (auto iPt = 0; iPt < confNumPt; ++iPt) {
135+
if (track.pt() > confPtBins.value[2 * iPt] && track.pt() < confPtBins.value[2 * iPt + 1]) {
136+
mHistArrQA[iPt * 4]->Fill(track.eta());
137+
mHistArrQA[iPt * 4 + 1]->Fill(track.pt());
138+
mHistArrQA[iPt * 4 + 2]->Fill(track.phi());
139+
countTracks[iPt]++;
140+
for (auto iM = 0; iM < nBins; ++iM) {
141+
mHistArrReset[iPt * nBins + iM]->Fill(track.eta(), track.phi());
142+
}
143+
}
144+
}
145+
}
146+
147+
void calculateMoments(std::vector<std::shared_ptr<TH2>> hist)
148+
{
149+
Double_t binContent = 0;
150+
// Calculate the normalized factorial moments
151+
for (auto iPt = 0; iPt < confNumPt; ++iPt) {
152+
for (auto iM = 0; iM < nBins; ++iM) {
153+
binContent = 0;
154+
Double_t sumfqBin[6] = {0};
155+
156+
for (auto iEta = 1; iEta <= hist[iPt * nBins + iM]->GetNbinsX(); ++iEta) {
157+
for (auto iPhi = 1; iPhi <= hist[iPt * nBins + iM]->GetNbinsY(); ++iPhi) {
158+
double binconVal = 0;
159+
binconVal = hist[iPt * nBins + iM]->GetBinContent(iEta, iPhi);
160+
binContent += binconVal;
161+
for (auto iOrder = 0; iOrder < 6; ++iOrder) {
162+
Double_t fqBin = 0;
163+
if (binconVal >= iOrder + 2) {
164+
fqBin = TMath::Factorial(binconVal) / (TMath::Factorial(binconVal - (iOrder + 2)));
165+
}
166+
if (isnan(fqBin)) {
167+
break;
168+
}
169+
sumfqBin[iOrder] += fqBin;
170+
}
171+
}
172+
}
173+
binConEvent[iPt][iM] = binContent / (TMath::Power(binningM[iM], 2));
174+
for (auto iOrder = 0; iOrder < 6; ++iOrder) {
175+
if (sumfqBin[iOrder] > 0) {
176+
fqEvent[iOrder][iPt][iM] = sumfqBin[iOrder] / (TMath::Power(binningM[iM], 2));
177+
}
178+
mFqBinFinal[iPt * 6 + iOrder]->Fill(iM, fqEvent[iOrder][iPt][iM]);
179+
mBinConFinal[iPt * 6 + iOrder]->Fill(iM, binConEvent[iPt][iM]);
180+
}
181+
} // end of loop over M bins
182+
} // end of loop over pT bins
183+
}
184+
185+
using TracksFMs = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA>>;
186+
void processRun3(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFV0As, aod::CentFT0Ms, aod::CentFT0As, aod::CentFT0Cs>>::iterator const& coll, TracksFMs const& tracks)
187+
{
188+
// selection of events
189+
if (!coll.sel8()) {
190+
return;
191+
}
192+
if (coll.centFT0C() < confCentCut.value[0] || coll.centFT0C() > confCentCut.value[1]) {
193+
return;
194+
}
195+
histos.fill(HIST("mVertexX"), coll.posX());
196+
histos.fill(HIST("mVertexY"), coll.posY());
197+
histos.fill(HIST("mVertexZ"), coll.posZ());
198+
histos.fill(HIST("mCentFT0M"), coll.centFT0M());
199+
histos.fill(HIST("mCentFV0A"), coll.centFV0A());
200+
histos.fill(HIST("mCentFT0A"), coll.centFT0A());
201+
histos.fill(HIST("mCentFT0C"), coll.centFT0C());
202+
203+
for (auto const& h : mHistArrReset) {
204+
h->Reset();
205+
}
206+
countTracks = {0, 0, 0, 0, 0};
207+
fqEvent = {0, 0, 0, 0, 0, 0};
208+
binConEvent = {0, 0, 0, 0, 0};
209+
210+
for (auto const& track : tracks) {
211+
if ((track.pt() < confPtMin) || (!track.isGlobalTrack()) || (track.tpcNClsFindable() < confMinTPCCls)) {
212+
continue;
213+
}
214+
histos.fill(HIST("mCollID"), track.collisionId());
215+
histos.fill(HIST("mEta"), track.eta());
216+
histos.fill(HIST("mPt"), track.pt());
217+
histos.fill(HIST("mPhi"), track.phi());
218+
histos.fill(HIST("mNFindableClsTPC"), track.tpcNClsFindable());
219+
histos.fill(HIST("mNClsTPC"), track.tpcNClsFound());
220+
histos.fill(HIST("mNClsITS"), track.itsNCls());
221+
histos.fill(HIST("mChi2TPC"), track.tpcChi2NCl());
222+
histos.fill(HIST("mChi2ITS"), track.itsChi2NCl());
223+
histos.fill(HIST("mChi2TRD"), track.trdChi2());
224+
histos.fill(HIST("mDCAxy"), track.dcaXY());
225+
histos.fill(HIST("mDCAx"), track.dcaZ());
226+
histos.fill(HIST("mDCAxyPt"), track.pt(), track.dcaXY());
227+
histos.fill(HIST("mDCAzPt"), track.pt(), track.dcaZ());
228+
histos.fill(HIST("mNSharedClsTPC"), track.tpcNClsShared());
229+
histos.fill(HIST("mCrossedRowsTPC"), track.tpcNClsCrossedRows());
230+
histos.fill(HIST("mNFinClsminusCRows"), track.tpcNClsFindableMinusCrossedRows());
231+
histos.fill(HIST("mNFractionShClsTPC"), track.tpcFractionSharedCls());
232+
histos.fill(HIST("mSharedClsvsPt"), track.pt(), track.tpcNClsShared());
233+
histos.fill(HIST("mSharedClsProbvsPt"), track.pt(), track.tpcFractionSharedCls() / track.tpcNClsCrossedRows());
234+
checkpT(track);
235+
}
236+
for (auto iPt = 0; iPt < confNumPt; ++iPt) {
237+
if (countTracks[iPt] > 0) {
238+
mHistArrQA[iPt * 4 + 3]->Fill(countTracks[iPt]);
239+
}
240+
}
241+
// Calculate the normalized factorial moments
242+
calculateMoments(mHistArrReset);
243+
}
244+
PROCESS_SWITCH(FactorialMoments, processRun3, "main process function", false);
245+
246+
void processRun2(soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentRun2V0Ms>>::iterator const& coll, TracksFMs const& tracks)
247+
{
248+
if ((!coll.alias_bit(kINT7)) || (!coll.sel7())) {
249+
return;
250+
}
251+
if (coll.centRun2V0M() < confCentCut.value[0] || coll.centRun2V0M() > confCentCut.value[1]) {
252+
return;
253+
}
254+
histos.fill(HIST("mVertexX"), coll.posX());
255+
histos.fill(HIST("mVertexY"), coll.posY());
256+
histos.fill(HIST("mVertexZ"), coll.posZ());
257+
histos.fill(HIST("mCentFT0M"), coll.centRun2V0M());
258+
for (auto const& h : mHistArrReset) {
259+
h->Reset();
260+
}
261+
262+
countTracks = {0, 0, 0, 0, 0};
263+
fqEvent = {0, 0, 0, 0, 0, 0};
264+
binConEvent = {0, 0, 0, 0, 0};
265+
266+
for (auto const& track : tracks) {
267+
if ((track.pt() < confPtMin) || (!track.isGlobalTrack()) || (track.tpcNClsFindable() < confMinTPCCls)) {
268+
continue;
269+
}
270+
histos.fill(HIST("mCollID"), track.collisionId());
271+
histos.fill(HIST("mEta"), track.eta());
272+
histos.fill(HIST("mPt"), track.pt());
273+
histos.fill(HIST("mPhi"), track.phi());
274+
histos.fill(HIST("mNFindableClsTPC"), track.tpcNClsFindable());
275+
histos.fill(HIST("mNClsTPC"), track.tpcNClsFound());
276+
histos.fill(HIST("mNClsITS"), track.itsNCls());
277+
histos.fill(HIST("mChi2TPC"), track.tpcChi2NCl());
278+
histos.fill(HIST("mChi2ITS"), track.itsChi2NCl());
279+
histos.fill(HIST("mChi2TRD"), track.trdChi2());
280+
histos.fill(HIST("mDCAxy"), track.dcaXY());
281+
histos.fill(HIST("mDCAx"), track.dcaZ());
282+
histos.fill(HIST("mDCAxyPt"), track.pt(), track.dcaXY());
283+
histos.fill(HIST("mDCAzPt"), track.pt(), track.dcaZ());
284+
histos.fill(HIST("mNSharedClsTPC"), track.tpcNClsShared());
285+
histos.fill(HIST("mCrossedRowsTPC"), track.tpcNClsCrossedRows());
286+
histos.fill(HIST("mNFinClsminusCRows"), track.tpcNClsFindableMinusCrossedRows());
287+
histos.fill(HIST("mNFractionShClsTPC"), track.tpcFractionSharedCls());
288+
histos.fill(HIST("mSharedClsvsPt"), track.pt(), track.tpcNClsShared());
289+
histos.fill(HIST("mSharedClsProbvsPt"), track.pt(), track.tpcFractionSharedCls() / track.tpcNClsCrossedRows());
290+
checkpT(track);
291+
}
292+
for (auto iPt = 0; iPt < confNumPt; ++iPt) {
293+
if (countTracks[iPt] > 0) {
294+
mHistArrQA[iPt * 4 + 3]->Fill(countTracks[iPt]);
295+
}
296+
}
297+
// Calculate the normalized factorial moments
298+
calculateMoments(mHistArrReset);
299+
}
300+
PROCESS_SWITCH(FactorialMoments, processRun2, "for RUN2", false);
301+
};
302+
303+
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
304+
{
305+
return WorkflowSpec{
306+
adaptAnalysisTask<FactorialMoments>(cfgc),
307+
};
308+
}

0 commit comments

Comments
 (0)