Skip to content

Commit 384a2fd

Browse files
authored
Refactor includes and update process functions
1 parent fc7b1e9 commit 384a2fd

File tree

1 file changed

+33
-35
lines changed

1 file changed

+33
-35
lines changed

PWGUD/Tasks/flowMcUpc.cxx

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -14,31 +14,27 @@
1414
/// \since Apr/2/2026
1515
/// \brief flow efficiency analysis on UPC MC
1616

17+
#include <CCDB/BasicCCDBManager.h>
1718
#include "PWGUD/Core/SGSelector.h"
1819
#include "PWGUD/DataModel/UDTables.h"
19-
20-
#include "Common/Core/RecoDecay.h"
21-
#include "Common/Core/TrackSelection.h"
22-
#include "Common/Core/TrackSelectionDefaults.h"
23-
#include "Common/Core/trackUtilities.h"
24-
#include "Common/DataModel/TrackSelectionTables.h"
25-
26-
#include "Framework/ASoAHelpers.h"
20+
#include <vector>
21+
#include <string>
2722
#include "Framework/AnalysisDataModel.h"
2823
#include "Framework/AnalysisTask.h"
2924
#include "Framework/HistogramRegistry.h"
30-
#include "Framework/RunningWorkflowInfo.h"
3125
#include "Framework/runDataProcessing.h"
26+
#include "Framework/ASoAHelpers.h"
27+
#include "Framework/RunningWorkflowInfo.h"
28+
#include "Common/DataModel/TrackSelectionTables.h"
29+
#include "Common/Core/RecoDecay.h"
30+
#include "Common/Core/TrackSelection.h"
31+
#include "Common/Core/TrackSelectionDefaults.h"
32+
#include "Common/Core/trackUtilities.h"
3233
#include "ReconstructionDataFormats/Track.h"
33-
#include <CCDB/BasicCCDBManager.h>
34-
35-
#include <TF1.h>
36-
#include <TPDGCode.h>
3734
#include <TProfile.h>
3835
#include <TRandom3.h>
39-
40-
#include <string>
41-
#include <vector>
36+
#include <TPDGCode.h>
37+
#include <TF1.h>
4238

4339
using namespace o2;
4440
using namespace o2::framework;
@@ -49,8 +45,6 @@ using namespace o2::framework::expressions;
4945
struct FlowMcUpc {
5046
HistogramRegistry histos{"Histos", {}, OutputObjHandlingPolicy::AnalysisObject};
5147

52-
// using BCs = soa::Join<aod::BCsWithTimestamps, aod::BcSels, aod::Run3MatchedToBCSparse>;
53-
5448
Configurable<float> minB{"minB", 0.0f, "min impact parameter"};
5549
Configurable<float> maxB{"maxB", 20.0f, "max impact parameter"};
5650
O2_DEFINE_CONFIGURABLE(cfgCutVertex, float, 10.0f, "Accepted z-vertex range")
@@ -60,6 +54,7 @@ struct FlowMcUpc {
6054
O2_DEFINE_CONFIGURABLE(cfgCutDCAxy, float, 0.2f, "DCAxy cut for tracks")
6155
O2_DEFINE_CONFIGURABLE(cfgDcaxy, bool, true, "choose dcaxy")
6256

57+
6358
ConfigurableAxis axisB{"axisB", {100, 0.0f, 20.0f}, ""};
6459
ConfigurableAxis axisPt{"axisPt", {VARIABLE_WIDTH, 0.0f, 0.1f, 0.2f, 0.3f, 0.4f, 0.5f, 0.6f, 0.7f, 0.8f, 0.9f, 1.0f, 1.1f, 1.2f, 1.3f, 1.4f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.2f, 2.4f, 2.6f, 2.8f, 3.0f, 3.2f, 3.4f, 3.6f, 3.8f, 4.0f, 4.4f, 4.8f, 5.2f, 5.6f, 6.0f, 6.5f, 7.0f, 7.5f, 8.0f, 9.0f, 10.0f, 11.0f, 12.0f}, "pt axis"};
6560
// Connect to ccdb
@@ -70,6 +65,7 @@ struct FlowMcUpc {
7065

7166
using McParticles = soa::Join<aod::UDMcParticles, aod::UDMcTrackLabels>;
7267

68+
7369
void init(InitContext&)
7470
{
7571
ccdb->setURL(ccdbUrl.value);
@@ -89,14 +85,15 @@ struct FlowMcUpc {
8985
histos.add<TH3>("hEtaPtVtxzMCGen", "Monte Carlo Truth; #eta; p_{T} (GeV/c); V_{z} (cm);", {HistType::kTH3D, {axisEta, axisPt, axisVertex}});
9086
histos.add<TH1>("hPtReco", "Monte Carlo Reco Global; pT (GeV/c);", {HistType::kTH1D, {axisPt}});
9187
histos.add<TH3>("hEtaPtVtxzMCReco", "Monte Carlo Global; #eta; p_{T} (GeV/c); V_{z} (cm);", {HistType::kTH3D, {axisEta, axisPt, axisVertex}});
92-
}
9388

94-
template <typename TCollision>
95-
bool eventSelected(TCollision collision)
96-
{
97-
return true;
9889
}
9990

91+
// template <typename TCollision>
92+
// bool eventSelected(TCollision collision)
93+
// {
94+
// return true;
95+
// }
96+
10097
template <typename TTrack>
10198
bool trackSelected(TTrack track)
10299
{
@@ -112,11 +109,11 @@ struct FlowMcUpc {
112109
return true;
113110
}
114111

115-
void processMCTrue(aod::UDMcCollisions::iterator const& mcCollision, McParticles const& mcParticles)
112+
void processMCTrue(aod::UDMcCollisions::iterator const& mcCollision, McParticles const& mcParticles, aod::BCs const& bcs)
116113
{
117-
// if (bcs.size() == 0) {
118-
// return;
119-
// }
114+
if (bcs.size() == 0) {
115+
return;
116+
}
120117
histos.fill(HIST("mcEventCounter"), 0.5);
121118
float imp = mcCollision.impactParameter();
122119
float vtxz = mcCollision.posZ();
@@ -139,22 +136,23 @@ struct FlowMcUpc {
139136
continue;
140137
// if (std::fabs(mcParticle.eta()) > cfgCutEta) // main acceptance
141138
// continue;
142-
139+
143140
histos.fill(HIST("hPtMCGen"), pt);
144141
histos.fill(HIST("hEtaPtVtxzMCGen"), eta, pt, vtxz);
145142
}
146143
}
144+
147145
}
148146
PROCESS_SWITCH(FlowMcUpc, processMCTrue, "process pure simulation information", true);
149147

150148
using MCRecoTracks = soa::Join<aod::UDTracks, aod::UDTracksPID, aod::UDTracksExtra, aod::UDTracksFlags, aod::UDTracksDCA, aod::UDMcTrackLabels>;
151-
using MCRecoCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::UDMcCollsLabels>;
149+
using MCRecoCollisions = soa::Join<aod::UDCollisions, aod::SGCollisions, aod::UDCollisionSelExtras, aod::UDCollisionsSels, aod::UDZdcsReduced, aod::UDMcCollsLabels>;
152150

153151
void processReco(MCRecoCollisions::iterator const& collision, MCRecoTracks const& tracks)
154152
{
155153
histos.fill(HIST("RecoProcessEventCounter"), 0.5);
156-
if (!eventSelected(collision))
157-
return;
154+
// if (!eventSelected(collision))
155+
// return;
158156
histos.fill(HIST("RecoProcessEventCounter"), 1.5);
159157
if (!collision.has_udMcCollision())
160158
return;
@@ -167,9 +165,9 @@ struct FlowMcUpc {
167165

168166
for (const auto& track : tracks) {
169167
auto momentum = std::array<double, 3>{track.px(), track.py(), track.pz()};
170-
double pt = RecoDecay::pt(momentum);
171-
double phi = RecoDecay::phi(momentum);
172-
double eta = RecoDecay::eta(momentum);
168+
double pt = RecoDecay::pt(momentum);
169+
double phi = RecoDecay::phi(momentum);
170+
double eta = RecoDecay::eta(momentum);
173171
if (!trackSelected(track) || (!track.has_udMcParticle()))
174172
continue;
175173
auto mcParticle = track.udMcParticle();
@@ -180,7 +178,7 @@ struct FlowMcUpc {
180178
// continue;
181179
if (!mcParticle.isPhysicalPrimary())
182180
continue;
183-
181+
184182
histos.fill(HIST("hPtReco"), pt);
185183
histos.fill(HIST("hEtaPtVtxzMCReco"), eta, pt, vtxz);
186184
}

0 commit comments

Comments
 (0)