Skip to content

Commit ae9c3ce

Browse files
author
Sabrina Hernandez
committed
adjusted O2 linter and added 2D histograms
1 parent 22e8759 commit ae9c3ce

File tree

1 file changed

+64
-53
lines changed

1 file changed

+64
-53
lines changed

PWGCF/Flow/Tasks/FlowZDCtask.cxx

Lines changed: 64 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@
88
// In applying this license CERN does not waive the privileges and immunities
99
// granted to it by virtue of its status as an Intergovernmental Organization
1010
// or submit itself to any jurisdiction.
11+
<<<<<<< HEAD
1112

1213
// o2-analysis-cf-flow-zdc-task --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-track-propagation --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-timestamp --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-event-selection --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-trackselection --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-centrality-table --aod-file AO2D.root --configuration json://configuration_run3.json | o2-analysis-multiplicity-table --aod-file AO2D.root --configuration json://configuration_run3.json -b
1314

15+
=======
16+
/// \file FlowZDCtask.cxx
17+
/// \author Sabrina Hernandez
18+
/// \since 08/01/2024
19+
/// \brief task to evaluate flow and neutron skin with information from ZDC
20+
>>>>>>> ad777c681 (adjusted O2 linter and added 2D histograms)
1421
#include <CCDB/BasicCCDBManager.h>
1522
#include <cmath>
1623
#include <vector>
24+
#include <complex>
1725
#include "Framework/runDataProcessing.h"
1826
#include "Framework/AnalysisTask.h"
1927
#include "Framework/ASoAHelpers.h"
@@ -71,6 +79,7 @@ struct FlowZDCtask {
7179
// for ZDC info and analysis
7280
Configurable<int> nBinsADC{"nBinsADC", 1000, "nbinsADC"};
7381
Configurable<int> nBinsAmp{"nBinsAmp", 1025, "nbinsAmp"};
82+
Configurable<int> nBinsFT0Amp{"nBinsFT0Amp", 250000, "nbinsAmp"};
7483
Configurable<float> MaxZN{"MaxZN", 4099.5, "Max ZN signal"};
7584
Configurable<float> acceptnace_ZNA{"acceptnace_ZNA", 0.92, "ZNA acceptance factor"};
7685
Configurable<float> acceptnace_ZNC{"acceptnace_ZNC", 0.90, "ZNC acceptance factor"};
@@ -81,8 +90,13 @@ struct FlowZDCtask {
8190
ConfigurableAxis axisPhi{"axisPhi", {60, 0.0, constants::math::TwoPI}, "phi axis for histograms"};
8291
ConfigurableAxis axisEta{"axisEta", {40, -1., 1.}, "eta axis for histograms"};
8392
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.30, 0.40, 0.45, 0.50, 0.55, 0.60, 0.65, 0.70, 0.75, 0.80, 0.85, 0.90, 0.95, 1.00, 1.10, 1.20, 1.30, 1.40, 1.50, 1.60, 1.70, 1.80, 1.90, 2.00, 2.20, 2.40, 2.60, 2.80, 3.00}, "pt axis for histograms"};
84-
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {2500, 0, 2500}, "centrality axis for histograms"};
93+
ConfigurableAxis axisMultiplicity{"axisMultiplicity", {3500, 0, 3500}, "centrality axis for histograms"};
8594
ConfigurableAxis axisEnergy{"axisEnergy", {100, 0, 700}, "energy axis for zdc histos"};
95+
ConfigurableAxis axisMultTPC{"axisaxisMultTPC", {1000, -0.5f, 1999.5f}, "TPCmultiplicity"};
96+
ConfigurableAxis axisZN{"axisZN", {5000, 0, 500}, "axisZN"};
97+
ConfigurableAxis axisZP{"axisZP", {5000, 0, 500}, "axisZP"};
98+
ConfigurableAxis axisFT0CAmp{"axisFT0CAmp", {60000, 0, 60000}, "axisFT0CAmp"};
99+
86100
Filter collisionFilter = nabs(aod::collision::posZ) < cfgCutVertex;
87101
Filter trackFilter = (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true)) && (aod::track::tpcChi2NCl < cfgCutChi2prTPCcls);
88102
Partition<aodTracks> tracksIUWithTPC = (aod::track::tpcNClsFindable > (uint8_t)0);
@@ -107,8 +121,6 @@ struct FlowZDCtask {
107121
OutputObj<TProfile> ZDC_ZEM_Energy{TProfile("ZDC_ZEM_Energy", "ZDC vs ZEM Energy", 10, 0, 1000)};
108122
OutputObj<TProfile> pCosPsiDifferences{TProfile("pCosPsiDifferences", "Differences in cos(psi) vs Centrality;Centrality;Mean cos(psi) Difference", 200, 0, 100, -1, 1)};
109123
OutputObj<TProfile> pSinPsiDifferences{TProfile("pSinPsiDifferences", "Differences in sin(psi) vs Centrality;Centrality;Mean sin(psi) Difference", 200, 0, 100, -1, 1)};
110-
OutputObj<TProfile> pZNvsFT0MAmp{TProfile("pZNvsFT0MAmp", "ZN Energy vs FT0M Amplitude", 1025, 0, 1e7, 0, 500)};
111-
OutputObj<TProfile> pZPvsFT0MAmp{TProfile("pZPvsFT0MAmp", "ZP Energy vs FT0M Amplitude", 1025, 0, 1e7, 0, 500)};
112124
OutputObj<TProfile> pZNvsFT0Ccent{TProfile("pZNvsFT0Ccent", "ZN Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
113125
OutputObj<TProfile> pZPvsFT0Ccent{TProfile("pZPvsFT0Ccent", "ZP Energy vs FT0C Centrality", 100, 0, 100, 0, 500)};
114126
OutputObj<TProfile> pZNratiovscent{TProfile("pZNratiovscent", "Ratio ZNC/ZNA vs FT0C Centrality", 100, 0, 100, 0, 5)};
@@ -125,7 +137,7 @@ struct FlowZDCtask {
125137

126138
const AxisSpec axisPt{nBinsPt, 0, 10, "p_{T} (GeV/c)"};
127139
const AxisSpec axisCounter{1, 0, +1, ""};
128-
const AxisSpec axisPhi{100, 0, 2 * TMath::Pi(), "#phi"};
140+
const AxisSpec axisPhi{100, 0, 2 * o2::constants::math::PI, "#phi"};
129141
const AxisSpec axisQ{100, -1, 1, "Q"};
130142
const AxisSpec axisZNA{100, 0, 200, "energy"};
131143
const AxisSpec axisQZNA{100, -1, 1, "Q"};
@@ -135,8 +147,6 @@ struct FlowZDCtask {
135147
AxisSpec axisVtxcounts{2, -0.5f, 1.5f, "Vtx info (0=no, 1=yes)"};
136148
AxisSpec axisZvert{120, -30.f, 30.f, "Vtx z (cm)"};
137149
AxisSpec axisCent{8, 0.f, 105.f, "centrality"};
138-
AxisSpec axisMult{2500, 0, 2500.0f, "multiplicity"};
139-
AxisSpec axisMultTPC{1000, -0.5f, 1999.5f, "TPCmultiplicity"};
140150
AxisSpec axisCentBins{{0, 5., 10., 20., 30., 40., 50., 60., 70., 80.}, "centrality percentile"};
141151
AxisSpec axisPtBins{{0., 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.2, 1.4, 1.6, 1.8, 2.0, 2.25, 2.5, 2.75, 3.0, 3.5, 4.0, 4.5, 5.0, 6.0, 8.0, 10., 13., 16., 20.}, "p_{T} (GeV/c)"};
142152

@@ -147,7 +157,7 @@ struct FlowZDCtask {
147157
histos.add("eventCounter", "eventCounter", kTH1F, {axisCounter});
148158
histos.add("centHistogram", "centHistogram", kTH1F, {axisCent});
149159
histos.add("multHistogram", "multHistogram", kTH1F, {axisMultiplicity});
150-
histos.add("multvsCent", "centrality vs multiplicity", kTH2F, {axisCent, axisMult});
160+
histos.add("multvsCent", "centrality vs multiplicity", kTH2F, {axisCent, axisMultiplicity});
151161
histos.add("phiHistogram", "phiHistogram", kTH1F, {axisPhi});
152162
histos.add("TPCmultiplicity", "TPCmultiplicity", kTH1F, {axisMultTPC});
153163

@@ -164,14 +174,14 @@ struct FlowZDCtask {
164174
histos.add("EnergyZNC", "ZNC Sector Energy", kTH1F, {axisEnergy});
165175
histos.add("hCentFT0C", "FT0C Centrality Distribution", kTH1F, {{100, 0, 105}});
166176
histos.add("hZNvsFT0Ccent",
167-
"ZN Energy vs FT0C Centrality;Centrality [%];ZN Energy [TeV]",
177+
"ZN Energy vs FT0C Centrality",
168178
kTH2F,
169-
{AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZN Energy [TeV]"}});
179+
{AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZN Energy"}});
170180

171181
histos.add("hZPvsFT0Ccent",
172-
"ZP Energy vs FT0C Centrality;Centrality [%];ZP Energy [TeV]",
182+
"ZP Energy vs FT0C Centrality;Centrality [%];ZP Energy",
173183
kTH2F,
174-
{AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZP Energy [TeV]"}});
184+
{AxisSpec{100, 0, 100, "Centrality [%]"}, AxisSpec{100, 0, 500, "ZP Energy"}});
175185
// for q vector recentering
176186
histos.add("revsimag", "revsimag", kTH2F, {axisREQ, axisIMQ});
177187

@@ -189,8 +199,8 @@ struct FlowZDCtask {
189199
histos.add("ImagQHistogramZNC", "ImagQHistogramZNC", kTH1F, {axisQZNA});
190200

191201
histos.add("Acorrelations", "Acorrelations", kTH2F, {{axisQZNA}, {axisQZNA}});
192-
histos.add("SPAngleZNA", "Spectator Plane Angle ZNA;Angle (radians);Entries", {HistType::kTH1F, {{100, -TMath::Pi(), TMath::Pi()}}});
193-
histos.add("SPAngleZNC", "Spectator Plane Angle ZNC;Angle (radians);Entries", {HistType::kTH1F, {{100, -TMath::Pi(), TMath::Pi()}}});
202+
histos.add("SPAngleZNA", "Spectator Plane Angle ZNA;Angle (radians);Entries", {HistType::kTH1F, {{100, -o2::constants::math::PI, o2::constants::math::PI}}});
203+
histos.add("SPAngleZNC", "Spectator Plane Angle ZNC;Angle (radians);Entries", {HistType::kTH1F, {{100, -o2::constants::math::PI, o2::constants::math::PI}}});
194204

195205
histos.add("RunningAverageCosPsiDiff", "Running Average of cos(psi) Differences;Running Average;Entries", {HistType::kTH1F, {{100, -1, 1}}});
196206

@@ -205,18 +215,24 @@ struct FlowZDCtask {
205215
histos.add("ZPAenergy", "ZP energy side a", kTH1F, {axisEnergy});
206216
histos.add("ZNenergy", "common zn (a + c sides) energy", kTH1F, {axisEnergy});
207217
histos.add("ZPenergy", "common zp energy (a + c sides)", kTH1F, {axisEnergy});
208-
histos.add("hFT0CAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}});
209-
histos.add("hFT0AAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}});
210-
histos.add("hFT0MAmp", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 1e7}});
211-
histos.add("hMultT0A", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
212-
histos.add("hMultT0C", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
213-
histos.add("hMultT0M", ";Amplitude;counts", kTH1F, {{nBinsAmp, 0, 250000}});
218+
histos.add("hFT0CAmp", ";Amplitude;counts", kTH1F, {axisFT0CAmp});
219+
histos.add("hFT0AAmp", ";Amplitude;counts", kTH1F, {{100000, 0, 100000}});
220+
histos.add("hFT0MAmp", ";Amplitude;counts", kTH1F, {{100000, 0, 100000}});
221+
histos.add("hMultT0A", ";Amplitude;counts", kTH1F, {{nBinsFT0Amp, 0, 250000}});
222+
histos.add("hMultT0C", ";Amplitude;counts", kTH1F, {{nBinsFT0Amp, 0, 250000}});
223+
histos.add("hMultT0M", ";Amplitude;counts", kTH1F, {{nBinsFT0Amp, 0, 250000}});
224+
histos.add("hZNvsFT0CAmp", "ZN Energy vs FT0C Amplitude", kTH2F, {axisFT0CAmp, axisZN});
225+
histos.add("hZPvsFT0CAmp", "ZP Energy vs FT0C Amplitude", kTH2F, {axisFT0CAmp, axisZP});
226+
histos.add("hZNvsMult", "ZN Energy vs Multiplicity", kTH2F, {axisMultiplicity, axisZN});
227+
histos.add("hZPvsMult", "ZP Energy vs Multiplicity", kTH2F, {axisMultiplicity, axisZP});
214228
}
215229
}
216230

217231
void processQVector(aodCollisions::iterator const& collision, aod::BCsWithTimestamps const&, aodTracks const& tracks, BCsRun3 const& /*bcs*/, aod::Zdcs const& /*zdcsData*/, aod::ZDCMults const& /*zdcMults*/)
218232
{
219233
histos.fill(HIST("eventCounter"), 0.5);
234+
if (!collision.sel8())
235+
return;
220236
histos.fill(HIST("centHistogram"), collision.centFT0C());
221237
const auto& tracksGrouped = tracksIUWithTPC->sliceByCached(aod::track::collisionId, collision.globalIndex(), cache);
222238
const int multTPC = tracksGrouped.size();
@@ -231,7 +247,7 @@ struct FlowZDCtask {
231247

232248
if (cent < 0.0 && cent > 70)
233249
return;
234-
TComplex qTPC(0, 0); // Starting with a q-vector of zero
250+
std::complex<double> qTPC(0, 0); // Starting with a q-vector of zero
235251

236252
for (auto& track : tracks) {
237253
double phi = track.phi();
@@ -240,14 +256,14 @@ struct FlowZDCtask {
240256
histos.fill(HIST("phiHistogram"), track.phi());
241257
histos.fill(HIST("ptHistogram"), track.pt());
242258

243-
qTPC += TComplex(TMath::Cos(2.0 * phi), TMath::Sin(2.0 * phi));
259+
qTPC += std::complex<double>(std::cos(2.0 * phi), std::sin(2.0 * phi));
244260

245261
histos.fill(HIST("multvsCent"), cent, Ntot);
246262

247263
} // end track loop
248264

249-
qTPC_real = qTPC.Re() / Ntot; // normalize these vectors by the total number of particles
250-
qTPC_im = qTPC.Im() / Ntot;
265+
qTPC_real = qTPC.real() / Ntot; // normalize these vectors by the total number of particles
266+
qTPC_im = qTPC.imag() / Ntot;
251267

252268
histos.fill(HIST("REqHistogram"), qTPC_real);
253269
histos.fill(HIST("IMqHistogram"), qTPC_im);
@@ -258,31 +274,22 @@ struct FlowZDCtask {
258274
histos.fill(HIST("revsimag"), qTPC_real, qTPC_im);
259275
}
260276
void processZdcCollAssoc(
261-
ColEvSels const& cols,
277+
aodCollisions::iterator const& collision,
278+
aodTracks const& tracks,
262279
BCsRun3 const& /*bcs*/,
263280
aod::Zdcs const& /*zdcs*/,
264281
aod::FT0s const& /*ft0s*/)
265282
{
283+
int Ntot = tracks.size();
266284
double sumCosPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging
267285
double sumSinPsiDiff = 0.0; // initialize Sum of cosPsiDiff for averaging
268286
int countEvents = 0; // initialize Counter for the number of events processed
269287
double FT0AAmp = 0;
270288
double FT0CAmp = 0;
271-
// init values for ft0 multiplicity
272-
float multFT0A = 0.f;
273-
float multFT0C = 0.f;
274-
float multFT0M = 0.f;
275-
276289
// collision-based event selection
277-
for (auto& collision : cols) {
290+
if (!collision.sel8())
291+
return;
278292
const auto& foundBC = collision.foundBC_as<BCsRun3>();
279-
multFT0A = collision.multFT0A();
280-
multFT0C = collision.multFT0C();
281-
multFT0M = multFT0A + multFT0C;
282-
283-
histos.fill(HIST("hMultT0A"), multFT0A);
284-
histos.fill(HIST("hMultT0C"), multFT0C);
285-
histos.fill(HIST("hMultT0M"), multFT0M);
286293
if (collision.has_foundFT0()) {
287294
auto ft0 = collision.foundFT0();
288295
for (auto amplitude : ft0.amplitudeA()) {
@@ -332,14 +339,17 @@ struct FlowZDCtask {
332339
histos.fill(HIST("ZPCenergy"), common_sumZPC);
333340
histos.fill(HIST("hZNvsFT0Ccent"), cent, sumZN);
334341
histos.fill(HIST("hZPvsFT0Ccent"), cent, sumZP);
342+
histos.fill(HIST("hZNvsFT0CAmp"), FT0CAmp, sumZN);
343+
histos.fill(HIST("hZPvsFT0CAmp"), FT0CAmp, sumZP);
344+
histos.fill(HIST("hZNvsMult"), Ntot, sumZN);
345+
histos.fill(HIST("hZPvsMult"), Ntot, sumZP);
346+
335347
float ratioZN = sumZNC / sumZNA;
336348
float ratioZP = sumZPC / sumZPA;
337349
pZNratiovscent->Fill(cent, ratioZN);
338350
pZPratiovscent->Fill(cent, ratioZP);
339351
pZNvsFT0Ccent->Fill(cent, sumZN);
340352
pZPvsFT0Ccent->Fill(cent, sumZP);
341-
pZPvsFT0MAmp->Fill(sumZP, FT0MAmp);
342-
pZNvsFT0MAmp->Fill(sumZN, FT0MAmp);
343353

344354
histos.get<TH2>(HIST("ZDC_energy_vs_ZEM"))->Fill(sumZEM, sumZDC);
345355

@@ -350,38 +360,39 @@ struct FlowZDCtask {
350360
double qZNA_im = 0.0;
351361
double qZNC_real = 0.0;
352362
double qZNC_im = 0.0;
353-
const double phiRadians[4] = {45 * TMath::Pi() / 180, 135 * TMath::Pi() / 180, 225 * TMath::Pi() / 180, 315 * TMath::Pi() / 180};
354-
TComplex qZNA(0, 0), qZNC(0, 0);
363+
const double phiRadians[4] = {45 * o2::constants::math::PI / 180, 135 * o2::constants::math::PI / 180, 225 * o2::constants::math::PI / 180, 315 * o2::constants::math::PI / 180};
364+
std::complex<double> qZNA = std::complex<double>(0.0, 0.0);
365+
std::complex<double> qZNC = std::complex<double>(0.0, 0.0);
355366

356367
for (int sector = 0; sector < 4; ++sector) {
357368
float energyZNA = zdcread.energySectorZNA()[sector];
358369
float energyZNC = zdcread.energySectorZNC()[sector];
359370

360-
qZNA += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNA / sumZNA, TMath::Sin(2 * phiRadians[sector]) * energyZNA / sumZNA);
361-
qZNC += TComplex(TMath::Cos(2 * phiRadians[sector]) * energyZNC / sumZNC, TMath::Sin(2 * phiRadians[sector]) * energyZNC / sumZNC);
371+
qZNA += std::complex<double>(std::cos(2 * phiRadians[sector]) * energyZNA / sumZNA, std::sin(2 * phiRadians[sector]) * energyZNA / sumZNA);
372+
qZNC += std::complex<double>(std::cos(2 * phiRadians[sector]) * energyZNC / sumZNC, std::sin(2 * phiRadians[sector]) * energyZNC / sumZNC);
362373
}
363374

364-
qZNA_real = qZNA.Re() / Ntot_ZNA;
365-
qZNA_im = qZNA.Im() / Ntot_ZNA;
366-
qZNC_real = qZNC.Re() / Ntot_ZNC;
367-
qZNC_im = qZNC.Im() / Ntot_ZNC;
375+
qZNA_real = qZNA.real() / Ntot_ZNA;
376+
qZNA_im = qZNA.imag() / Ntot_ZNA;
377+
qZNC_real = qZNC.real() / Ntot_ZNC;
378+
qZNC_im = qZNC.imag() / Ntot_ZNC;
368379

369-
histos.fill(HIST("Acorrelations"), qZNA.Re(), qZNA.Im());
380+
histos.fill(HIST("Acorrelations"), qZNA.real(), qZNA.imag());
370381
histos.fill(HIST("RealQHistogramZNA"), qZNA_real);
371382
histos.fill(HIST("ImagQHistogramZNA"), qZNA_im);
372383
histos.fill(HIST("RealQHistogramZNC"), qZNC_real);
373384
histos.fill(HIST("ImagQHistogramZNC"), qZNC_im);
374385

375386
// Calculate the spectator plane angles for ZNA and ZNC
376-
double psiZNA = TMath::ATan2(qZNA.Im(), qZNA.Re()) / 2;
377-
double psiZNC = TMath::ATan2(qZNC.Im(), qZNC.Re()) / 2;
387+
double psiZNA = std::atan2(qZNA.imag(), qZNA.real()) / 2.0;
388+
double psiZNC = std::atan2(qZNC.imag(), qZNC.real()) / 2.0;
378389

379390
// Fill the histograms with the calculated angles
380391
histos.fill(HIST("SPAngleZNA"), psiZNA);
381392
histos.fill(HIST("SPAngleZNC"), psiZNC);
382393

383-
double cosPsiDiff = TMath::Cos(psiZNA) - TMath::Cos(psiZNC);
384-
double sinPsiDiff = TMath::Sin(psiZNA) - TMath::Sin(psiZNC);
394+
double cosPsiDiff = std::cos(psiZNA) - std::cos(psiZNC);
395+
double sinPsiDiff = std::sin(psiZNA) - std::sin(psiZNC);
385396

386397
sumCosPsiDiff += cosPsiDiff;
387398
sumSinPsiDiff += sinPsiDiff;
@@ -397,7 +408,7 @@ struct FlowZDCtask {
397408
histos.fill(HIST("CosPsiDifferences"), cosPsiDiff);
398409
histos.fill(HIST("hSinDifferences"), sinPsiDiff);
399410
}
400-
}
411+
401412
}
402413

403414
PROCESS_SWITCH(FlowZDCtask, processZdcCollAssoc, "Processing ZDC w. collision association", true);

0 commit comments

Comments
 (0)