Skip to content

Commit 82ee952

Browse files
authored
[PWGUD] flowCorrelationsUpc: use truegapside producer instead of calculating it in the test (#16189)
1 parent d46f77c commit 82ee952

1 file changed

Lines changed: 72 additions & 86 deletions

File tree

PWGUD/Tasks/flowCorrelationsUpc.cxx

Lines changed: 72 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "PWGCF/GenericFramework/Core/GFWWeights.h"
1919
#include "PWGUD/Core/SGSelector.h"
2020
#include "PWGUD/DataModel/UDTables.h"
21+
#include "PWGUD/DataModel/UDTruegapsideTables.h"
2122

2223
#include "Common/Core/RecoDecay.h"
2324

@@ -50,17 +51,17 @@
5051
#include <utility>
5152
#include <vector>
5253

53-
namespace o2::aod
54-
{
55-
namespace flowcorrupc
56-
{
57-
DECLARE_SOA_COLUMN(Multiplicity, multiplicity, int);
58-
DECLARE_SOA_COLUMN(Truegapside, truegapside, int);
59-
} // namespace flowcorrupc
60-
DECLARE_SOA_TABLE(Multiplicity, "AOD", "MULTIPLICITY",
61-
flowcorrupc::Multiplicity);
62-
DECLARE_SOA_TABLE(Truegapside, "AOD", "TRUEGAPSIDE", flowcorrupc::Truegapside);
63-
} // namespace o2::aod
54+
// namespace o2::aod
55+
// {
56+
// namespace flowcorrupc
57+
// {
58+
// DECLARE_SOA_COLUMN(Multiplicity, multiplicity, int);
59+
// DECLARE_SOA_COLUMN(Truegapside, truegapside, int);
60+
// } // namespace flowcorrupc
61+
// DECLARE_SOA_TABLE(Multiplicity, "AOD", "MULTIPLICITY",
62+
// flowcorrupc::Multiplicity);
63+
// DECLARE_SOA_TABLE(Truegapside, "AOD", "TRUEGAPSIDE", flowcorrupc::Truegapside);
64+
// } // namespace o2::aod
6465

6566
using namespace o2;
6667
using namespace o2::framework;
@@ -70,57 +71,57 @@ using namespace o2::constants::math;
7071
// define the filtered collisions and tracks
7172
#define O2_DEFINE_CONFIGURABLE(NAME, TYPE, DEFAULT, HELP) Configurable<TYPE> NAME{#NAME, DEFAULT, HELP};
7273

73-
struct CalcNchUpc {
74-
O2_DEFINE_CONFIGURABLE(cfgZVtxCut, float, 10.0f, "Accepted z-vertex range")
75-
O2_DEFINE_CONFIGURABLE(cfgPtCutMin, float, 0.1f, "minimum accepted track pT")
76-
O2_DEFINE_CONFIGURABLE(cfgEtaCut, float, 0.9f, "Eta cut")
77-
O2_DEFINE_CONFIGURABLE(cfgMinMixEventNum, int, 5, "Minimum number of events to mix")
78-
79-
// Added UPC Cuts
80-
SGSelector sgSelector;
81-
Configurable<float> cfgCutFV0{"cfgCutFV0", 50., "FV0A threshold"};
82-
Configurable<float> cfgCutFT0A{"cfgCutFT0A", 150., "FT0A threshold"};
83-
Configurable<float> cfgCutFT0C{"cfgCutFT0C", 50., "FT0C threshold"};
84-
Configurable<float> cfgCutZDC{"cfgCutZDC", 10., "ZDC threshold"};
85-
86-
// Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true));
87-
88-
using UdTracks = soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksPID>;
89-
using UdTracksFull = soa::Join<aod::UDTracks, aod::UDTracksPID, aod::UDTracksExtra, aod::UDTracksFlags, aod::UDTracksDCA>;
90-
using UDCollisionsFull = soa::Join<aod::UDCollisions, aod::SGCollisions, aod::UDCollisionsSels, aod::UDZdcsReduced, aod::UDCollisionSelExtras>;
91-
92-
Produces<aod::Multiplicity> multiplicityNch;
93-
Produces<aod::Truegapside> truegapside;
94-
95-
HistogramRegistry registry{"registry"};
96-
97-
void init(InitContext&)
98-
{
99-
AxisSpec axisNch = {100, 0, 100};
100-
AxisSpec axisVrtx = {10, -10, 10};
101-
// AxisSpec axisgap = {12, -6, 6};
102-
// std::vector<AxisSpec> trueGapBins = {-2, -1, 0, 1, 2, 3};
103-
// AxisSpec axisgap = {trueGapBins, "true gap side"};
104-
105-
std::vector<double> binEdges = {-1.5, -0.5, 0.5, 1.5, 2.5, 3.5};
106-
AxisSpec axisgap = {binEdges, "true gap side"};
107-
registry.add("truegap", "truegap", {HistType::kTH1D, {axisgap}});
108-
109-
registry.add("Ncharge", "N_{charge}", {HistType::kTH1D, {axisNch}});
110-
registry.add("zVtx_all", "zVtx_all", {HistType::kTH1D, {axisVrtx}});
111-
registry.add("Nch_vs_zVtx", "Nch vs zVtx", {HistType::kTH2D, {axisVrtx, axisNch}});
112-
// registry.add("truegap", "truegap", {HistType::kTH1D, {axisgap}});
113-
}
114-
115-
void process(UDCollisionsFull::iterator const& collision, UdTracksFull const& tracks)
116-
{
117-
multiplicityNch(tracks.size());
118-
truegapside(sgSelector.trueGap(collision, cfgCutFV0, cfgCutFT0A, cfgCutFT0C, cfgCutZDC));
119-
// LOG(info) << "truegapside=" << sgSelector.trueGap(collision, cfgCutFV0, cfgCutFT0A, cfgCutFT0C, cfgCutZDC);
120-
registry.fill(HIST("Ncharge"), tracks.size());
121-
registry.fill(HIST("zVtx_all"), collision.posZ());
122-
}
123-
};
74+
// struct CalcNchUpc {
75+
// O2_DEFINE_CONFIGURABLE(cfgZVtxCut, float, 10.0f, "Accepted z-vertex range")
76+
// O2_DEFINE_CONFIGURABLE(cfgPtCutMin, float, 0.1f, "minimum accepted track pT")
77+
// O2_DEFINE_CONFIGURABLE(cfgEtaCut, float, 0.9f, "Eta cut")
78+
// O2_DEFINE_CONFIGURABLE(cfgMinMixEventNum, int, 5, "Minimum number of events to mix")
79+
80+
// // Added UPC Cuts
81+
// SGSelector sgSelector;
82+
// Configurable<float> cfgCutFV0{"cfgCutFV0", 50., "FV0A threshold"};
83+
// Configurable<float> cfgCutFT0A{"cfgCutFT0A", 150., "FT0A threshold"};
84+
// Configurable<float> cfgCutFT0C{"cfgCutFT0C", 50., "FT0C threshold"};
85+
// Configurable<float> cfgCutZDC{"cfgCutZDC", 10., "ZDC threshold"};
86+
87+
// // Filter trackFilter = (nabs(aod::track::eta) < cfgEtaCut) && (aod::track::pt > cfgPtCutMin) && (aod::track::pt < cfgPtCutMax) && ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == (uint8_t) true));
88+
89+
// using UdTracks = soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksPID>;
90+
// using UdTracksFull = soa::Join<aod::UDTracks, aod::UDTracksPID, aod::UDTracksExtra, aod::UDTracksFlags, aod::UDTracksDCA>;
91+
// using UDCollisionsFull = soa::Join<aod::UDCollisions, aod::SGCollisions, aod::UDCollisionsSels, aod::UDZdcsReduced, aod::UDCollisionSelExtras>;
92+
93+
// Produces<aod::Multiplicity> multiplicityNch;
94+
// Produces<aod::Truegapside> truegapside;
95+
96+
// HistogramRegistry registry{"registry"};
97+
98+
// void init(InitContext&)
99+
// {
100+
// AxisSpec axisNch = {100, 0, 100};
101+
// AxisSpec axisVrtx = {10, -10, 10};
102+
// // AxisSpec axisgap = {12, -6, 6};
103+
// // std::vector<AxisSpec> trueGapBins = {-2, -1, 0, 1, 2, 3};
104+
// // AxisSpec axisgap = {trueGapBins, "true gap side"};
105+
106+
// std::vector<double> binEdges = {-1.5, -0.5, 0.5, 1.5, 2.5, 3.5};
107+
// AxisSpec axisgap = {binEdges, "true gap side"};
108+
// registry.add("truegap", "truegap", {HistType::kTH1D, {axisgap}});
109+
110+
// registry.add("Ncharge", "N_{charge}", {HistType::kTH1D, {axisNch}});
111+
// registry.add("zVtx_all", "zVtx_all", {HistType::kTH1D, {axisVrtx}});
112+
// registry.add("Nch_vs_zVtx", "Nch vs zVtx", {HistType::kTH2D, {axisVrtx, axisNch}});
113+
// // registry.add("truegap", "truegap", {HistType::kTH1D, {axisgap}});
114+
// }
115+
116+
// void process(UDCollisionsFull::iterator const& collision, UdTracksFull const& tracks)
117+
// {
118+
// multiplicityNch(tracks.size());
119+
// truegapside(sgSelector.trueGap(collision, cfgCutFV0, cfgCutFT0A, cfgCutFT0C, cfgCutZDC));
120+
// // LOG(info) << "truegapside=" << sgSelector.trueGap(collision, cfgCutFV0, cfgCutFT0A, cfgCutFT0C, cfgCutZDC);
121+
// registry.fill(HIST("Ncharge"), tracks.size());
122+
// registry.fill(HIST("zVtx_all"), collision.posZ());
123+
// }
124+
// };
124125

125126
struct FlowCorrelationsUpc {
126127
O2_DEFINE_CONFIGURABLE(cfgZVtxCut, float, 10.0f, "Accepted z-vertex range")
@@ -141,9 +142,8 @@ struct FlowCorrelationsUpc {
141142
O2_DEFINE_CONFIGURABLE(cfgDcaz, bool, false, "choose dcaz")
142143
O2_DEFINE_CONFIGURABLE(cfgDcazCut, float, 10.0, "dcaz cut")
143144
O2_DEFINE_CONFIGURABLE(cfgMaxTPCChi2NCl, int, 4, "tpcchi2")
144-
O2_DEFINE_CONFIGURABLE(cfgCutOccupancy, bool, true, "Occupancy cut")
145-
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyHigh, int, 1000, "High cut on TPC occupancy")
146-
O2_DEFINE_CONFIGURABLE(cfgCutOccupancyLow, int, 0, "Low cut on TPC occupancy")
145+
O2_DEFINE_CONFIGURABLE(cfgGapSide, int, 1, "choose one side 0:A; 1:C")
146+
O2_DEFINE_CONFIGURABLE(cfgGapSideMerge, bool, true, "merge A and C side")
147147
O2_DEFINE_CONFIGURABLE(cfgCutTPCCrossedRows, float, 70.0f, "minimum number of crossed TPC Rows")
148148
O2_DEFINE_CONFIGURABLE(cfgCutTPCclu, float, 50.0f, "minimum number of found TPC clusters")
149149
O2_DEFINE_CONFIGURABLE(cfgCutITSclu, float, 5.0f, "minimum number of ITS clusters")
@@ -184,7 +184,11 @@ struct FlowCorrelationsUpc {
184184

185185
// make the filters and cuts.
186186
Filter trackFilter = (aod::udtrack::isPVContributor == true);
187-
Filter collisionFilter = ((aod::udcollision::gapSide == (uint8_t)1 || aod::udcollision::gapSide == (uint8_t)0) && (cfgIfVertex == false || aod::collision::posZ < cfgZVtxCut) && (!cfgCutOccupancy || (aod::udcollision::occupancyInTime > 0 && aod::udcollision::occupancyInTime < cfgCutOccupancyHigh)) && (aod::flowcorrupc::truegapside == 1 || aod::flowcorrupc::truegapside == 0));
187+
Filter collisionFilter = (cfgGapSideMerge == true)
188+
? ((aod::udcollision::gapSide == (uint8_t)0 || aod::udcollision::gapSide == (uint8_t)1) &&
189+
(aod::upcservice::truegapside == 0 || aod::upcservice::truegapside == 1))
190+
: ((aod::udcollision::gapSide == (uint8_t)cfgGapSide) &&
191+
(aod::upcservice::truegapside == cfgGapSide));
188192

189193
// Connect to ccdb
190194
Service<ccdb::BasicCCDBManager> ccdb;
@@ -200,7 +204,7 @@ struct FlowCorrelationsUpc {
200204
using UdTracks = soa::Filtered<soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksPID>>;
201205
using UdTracksFull = soa::Filtered<soa::Join<aod::UDTracks, aod::UDTracksPID, aod::UDTracksExtra, aod::UDTracksFlags, aod::UDTracksDCA>>;
202206

203-
using UDCollisionsFull = soa::Filtered<soa::Join<aod::UDCollisions, aod::SGCollisions, aod::UDCollisionsSels, aod::UDZdcsReduced, aod::Multiplicity, aod::Truegapside, aod::UDCollisionSelExtras>>;
207+
using UDCollisionsFull = soa::Filtered<soa::Join<aod::UDCollisions, aod::Truegapside, aod::SGCollisions, aod::UDCollisionsSels, aod::UDZdcsReduced, aod::Truegapside, aod::UDCollisionSelExtras>>;
204208

205209
// Define the outputs
206210
OutputObj<CorrelationContainer> same{Form("sameEvent_%i_%i", static_cast<int>(cfgMinMult), static_cast<int>(cfgMaxMult))};
@@ -358,21 +362,6 @@ struct FlowCorrelationsUpc {
358362
weight_nue = 1. / eff;
359363
return true;
360364
}
361-
362-
bool setCurrentParticleWeights(float& weight_nue, float& weight_nua, float pt)
363-
{
364-
float eff = 1.;
365-
if (mEfficiency)
366-
eff = mEfficiency->GetBinContent(mEfficiency->FindBin(pt));
367-
else
368-
eff = 1.0;
369-
if (eff == 0)
370-
return false;
371-
weight_nue = 1. / eff;
372-
weight_nua = 1.; // Set to 1 as NUA weight is not being used
373-
return true;
374-
}
375-
376365
// fill multiple histograms
377366
template <typename TCollision, typename TTracks>
378367
void fillYield(TCollision collision, TTracks tracks, float vtxz) // function to fill the yield and etaphi histograms.
@@ -430,9 +419,6 @@ struct FlowCorrelationsUpc {
430419

431420
// 计算track1的权重
432421
float weff1 = 1., wacc1 = 1.;
433-
if (!setCurrentParticleWeights(weff1, wacc1, pt1))
434-
continue;
435-
436422
if (system == SameEvent) {
437423
registry.fill(HIST("Trig_hist"), fSampleIndex, posZ, independent, pt1, eventWeight * weff1 * wacc1);
438424
}
@@ -621,7 +607,7 @@ struct FlowCorrelationsUpc {
621607
WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
622608
{
623609
return WorkflowSpec{
624-
adaptAnalysisTask<CalcNchUpc>(cfgc),
610+
// adaptAnalysisTask<CalcNchUpc>(cfgc),
625611
adaptAnalysisTask<FlowCorrelationsUpc>(cfgc),
626612
};
627613
}

0 commit comments

Comments
 (0)