Skip to content

Commit 75dfe35

Browse files
vojmachVojtech Machacek
andauthored
[PWGCF] flowSmallSystems: Add Zorro with HM triggers option. Avoid variable copies. Link event filtering library. (#18819)
Co-authored-by: Vojtech Machacek <[email protected]>
1 parent b4729f2 commit 75dfe35

2 files changed

Lines changed: 47 additions & 8 deletions

File tree

‎PWGCF/Flow/Tasks/CMakeLists.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,5 +121,5 @@ o2physics_add_dpl_workflow(flow-directed-flow-task
121121

122122
o2physics_add_dpl_workflow(flow-small-systems
123123
SOURCES flowSmallSystems.cxx
124-
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::GFWCore
124+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::GFWCore O2Physics::EventFilteringUtils
125125
COMPONENT_NAME Analysis)

‎PWGCF/Flow/Tasks/flowSmallSystems.cxx‎

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include "Common/CCDB/EventSelectionParams.h"
2323
#include "Common/CCDB/RCTSelectionFlags.h"
24+
#include "Common/Core/Zorro.h"
25+
#include "Common/Core/ZorroSummary.h"
2426
#include "Common/DataModel/Centrality.h"
2527
#include "Common/DataModel/EventSelection.h"
2628
#include "Common/DataModel/Multiplicity.h"
@@ -133,6 +135,10 @@ struct FlowSmallSystems {
133135
Configurable<LabeledArray<int>> cfgDefineGFWRegions{"cfgDefineGFWRegions", {LongArrayInt.front().data(), 9, 1, {"Standard", "DeltaEta>0", "DeltaEta>0.2", "DeltaEta>0.4", "DeltaEta>0.6", "DeltaEta>0.8", "DeltaEta>1.0", "DeltaEta>1.2", "DeltaEta>1.4"}, {"Enabled"}}, "Switch (0/1) for various GFW region initialzation"};
134136
Configurable<GFWCorrConfigs> cfgCorrConfig{"cfgCorrConfig", {{"refP {2} refN {-2}", "refP {3} refN {-3}", "refP {4} refN {-4}", "refFull {2 -2}", "refFull {2 2 -2 -2}"}, {"ChGap22", "ChGap32", "ChGap42", "ChFull22", "ChFull24"}, {0, 0, 0, 0, 0}, {15, 1, 1, 0, 0}}, "Configurations for each correlation to calculate"};
135137
} cfgGFWSettings;
138+
struct : ConfigurableGroup {
139+
O2_DEFINE_CONFIGURABLE(cfgUseHighMultTrigger, bool, false, "Enable HM trigger");
140+
O2_DEFINE_CONFIGURABLE(cfgHighMultiplicityTriggerMenu, int, 0, "0: HighTrackMult; 1: HighMultFv0; 2: HighFt0Mult; 3: HighFt0cFv0Mult; 4: HighFt0Flat; 5: HighFt0cFv0Flat");
141+
} cfgTriggeredData;
136142
O2_DEFINE_CONFIGURABLE(cfgNUAWeightsRunByRun, bool, true, "Fill NUA weights run by run")
137143
O2_DEFINE_CONFIGURABLE(cfgGetNumberOfCorr, bool, false, "Get histograms with number of correlations")
138144
Configurable<std::vector<int>> cfgFirstFillRunsList{"cfgFirstFillRunsList", std::vector<int>{}, "First run of the fill for time-dependent analysis, keep empty to disable"};
@@ -144,10 +150,11 @@ struct FlowSmallSystems {
144150
Configurable<std::vector<int>> cfgRemovedRunList{"cfgRemovedRunList", std::vector<int>{-1}, "excluded run numbers"};
145151
Configurable<LabeledArray<float>> cfgTrackCuts{"cfgTrackCuts", {LongArrayFloat.front().data(), 7, 2, {"chi2 per TPCcls", "TPC cluster", "TPC crossed rows", "ITS cluster", "DCAxy (Nsigma)", "DCAz (Nsigma)", "DCAz (cm) override"}, {"Nch", "Observable"}}, "separate Nch and observable track selections"};
146152
ConfigurableAxis binningNch{"binningNch", {VARIABLE_WIDTH, 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120, 130, 140, 150, 160, 170, 180, 190, 200, 210, 220, 230, 240, 250, 260, 270, 280, 290, 300, 310, 320, 330, 340, 350, 360, 370, 380, 390, 400, 410, 420, 430, 440, 460, 470, 480, 490, 500}, "binning for N_{ch} histograms"};
147-
ConfigurableAxis binningTime{"binningTime", {12, 0, 12}, "binning for time-dependent histograms transmutation QA"};
153+
ConfigurableAxis binningTime{"binningTime", {12, 0, 12}, "binning for time-dependent histograms QA"};
148154
ConfigurableAxis binningPt{"binningPt", {VARIABLE_WIDTH, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 0.55, 0.6, 0.65, 0.7, 0.75, 0.8, 0.85, 0.9, 0.95, 1, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9, 2, 2.2, 2.4, 2.6, 2.8, 3, 3.5, 4, 5, 6, 8, 10}, "binning for pT histograms"};
149155
HistogramRegistry registryQA{"registryQA"};
150156
HistogramRegistry registryCorr{"registryCorr"};
157+
HistogramRegistry registryTrigger{"registryTrigger"};
151158
Filter collisionFilter = (nabs(aod::collision::posZ) < cfgEventSelection.cfgCutVertex);
152159
Filter trackFilter = ((requireGlobalTrackInFilter()) || (aod::track::isGlobalTrackSDD == static_cast<uint8_t>(true))) && (nabs(aod::track::eta) < cfgCutEta) && (aod::track::pt > cfgCutPtMin) && (aod::track::pt < cfgCutPtMax);
153160
Service<ccdb::BasicCCDBManager> ccdb{};
@@ -223,6 +230,15 @@ struct FlowSmallSystems {
223230
Min8PC = 3,
224231

225232
};
233+
enum HighMultTriggerMenu {
234+
HighTrackMult = 0,
235+
HighMultFv0,
236+
HighFt0Mult,
237+
HighFt0cFv0Mult,
238+
HighFt0Flat,
239+
HighFt0cFv0Flat,
240+
TriggerMenuCounter
241+
};
226242
struct EventCut {
227243
bool enabled;
228244
int histBin;
@@ -240,6 +256,7 @@ struct FlowSmallSystems {
240256
} weight;
241257
static constexpr std::array<std::string_view, 2> FillTimeName = {"beforeEventSelQA/", "afterEventSelQA/"};
242258
static constexpr std::array<std::string_view, 2> FillTrackName = {"cutNch/", "cutObs/"};
259+
std::array<std::string, TriggerMenuCounter> triggerName = {"fHighTrackMult", "HighMultFv0", "fHighFt0Mult", "fHighFt0cFv0Mult", "fHighFt0Flat", "fHighFt0cFv0Flat"};
243260

244261
std::array<EventCut, 8> eventSelectionCuts{};
245262
std::array<std::array<float, 2>, 7> trackSel{};
@@ -258,19 +275,25 @@ struct FlowSmallSystems {
258275
std::array<TF1*, 2> fDCAxyCut{};
259276
std::vector<int> runNumbers;
260277
std::map<int, std::shared_ptr<TH3>> th3sPerRun;
278+
261279
int firstRunOfFill = -1;
280+
262281
GFW* fGFW = new GFW();
263282
std::vector<GFW::CorrConfig> corrConfigs;
264283
GFWRegions cacheRegions;
265284
GFWCorrConfigs cacheCorrConfig;
266285
TAxis* axisPtGFW = nullptr;
267286
OutputObj<FlowContainer> fFC{"FlowContainer"};
287+
288+
Zorro zorro;
289+
OutputObj<ZorroSummary> zorroSummary{"zorroSummary"};
290+
268291
TH1D* hEff = nullptr;
269292
TH1D* mEfficiencyForNch = nullptr;
270293
GFWWeights* mAcceptance = nullptr;
271294
TRandom3* fRndm = new TRandom3(0);
272295

273-
int getCorrectITSLayersFlag(int flag)
296+
int getCorrectITSLayersFlag(const int& flag)
274297
{
275298
switch (flag) {
276299
case ITSLayersAll:
@@ -373,8 +396,12 @@ struct FlowSmallSystems {
373396
registryQA.addClone("cutNch/", "cutObs/");
374397
registryQA.add("hVtxZ", "Vertex Z distribution;Vtxz (cm);Count", {HistType::kTH1D, {axisVertex}});
375398
registryQA.add("hCentrality", "Centrality distribution;Centrality;Count", {HistType::kTH1D, {axisCent}});
399+
registryQA.add("hNch", "N_{ch} distribution;N_{ch}^{raw};Count", {HistType::kTH1D, {axisNch}});
400+
if (!cfgGFWSettings.cfgEfficiencyNch.value.empty()) {
401+
registryQA.add("hNchCorrected", "N_{ch} distribution;N_{ch}^{corrected};Count", {HistType::kTH1D, {axisNch}});
402+
}
376403
registryQA.add("hEventCount", "Number of Event;; Count", {HistType::kTH1D, {{13, 0.5, 13.5}}});
377-
registryQA.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(FilteredEvent, "Filtered event");
404+
registryQA.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(FilteredEvent, (cfgTriggeredData.cfgUseHighMultTrigger) ? "Filtered event + HM Trigger" : "Filtered event");
378405
registryQA.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(Sel8, "after sel8");
379406
registryQA.get<TH1>(HIST("hEventCount"))->GetXaxis()->SetBinLabel(RCTflags, "RCTflags");
380407
std::array<std::string, 4> itsLayersFlag = {"ITSLayers-Disabled", "ITSLayersAll", "ITSLayers0123", "ITSLayer3"};
@@ -580,6 +607,9 @@ struct FlowSmallSystems {
580607
fFC->Initialize(oba, axisGFW, cfgGFWSettings.cfgBootstrapSamples);
581608
}
582609
delete oba;
610+
if (cfgTriggeredData.cfgUseHighMultTrigger) {
611+
zorroSummary.setObject(zorro.getZorroSummary());
612+
}
583613
}
584614
template <typename TCollision>
585615
float getCentrality(const TCollision& collision)
@@ -604,7 +634,7 @@ struct FlowSmallSystems {
604634
}
605635
}
606636
template <typename TCollision>
607-
bool selectMultiplicityCorrelation(const TCollision& collision, const int multTrk, const float& centrality)
637+
bool selectMultiplicityCorrelation(const TCollision& collision, const int& multTrk, const float& centrality)
608638
{
609639
auto multNTracksPV = collision.multNTracksPV();
610640
if (cfgMultiplicityCorrelationCut.cfgGlobalMultPVMultCutEnabled) {
@@ -630,7 +660,7 @@ struct FlowSmallSystems {
630660
return true;
631661
}
632662
template <typename TCollision>
633-
bool eventSelected(const TCollision& collision, const int multTrk, const float centrality, const int runNumber)
663+
bool eventSelected(const TCollision& collision, const int& multTrk, const float& centrality, const int& runNumber)
634664
{
635665
if (!cfgEventSelection.cfgEvSelUsage) {
636666
return true;
@@ -806,15 +836,15 @@ struct FlowSmallSystems {
806836
}
807837
}
808838
}
809-
double getTimeSinceStartOfFill(uint64_t timestamp, int firstRun)
839+
double getTimeSinceStartOfFill(const uint64_t& timestamp, const int& firstRun)
810840
{
811841
auto runDuration = ccdb->getRunDuration(firstRun);
812842
uint64_t tsSOF = runDuration.first;
813843
uint64_t diff = timestamp - tsSOF;
814844
return static_cast<double>(diff) / 3600000.0;
815845
}
816846
template <typename TTrack>
817-
inline void fillGFW(TTrack& track, const float& vtxZ)
847+
inline void fillGFW(const TTrack& track, const float& vtxZ)
818848
{
819849
bool isRef = (track.pt() < cfgGFWSettings.cfgCutPtRefMax && track.pt() > cfgGFWSettings.cfgCutPtRefMin);
820850
bool isPOI = (track.pt() < cfgGFWSettings.cfgCutPtPOIMax && track.pt() > cfgGFWSettings.cfgCutPtPOIMin);
@@ -848,6 +878,13 @@ struct FlowSmallSystems {
848878
float nchCorrected = 0;
849879
double lRandom = fRndm->Rndm();
850880
std::array<TrackRegion, 8> trackCorr{TrackRegion{.forward = 0, .backward = 0, .gap = 0.}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.1}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.2}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.3}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.4}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.5}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.6}, TrackRegion{.forward = 0, .backward = 0, .gap = 0.7}};
881+
if (cfgTriggeredData.cfgUseHighMultTrigger) {
882+
zorro.initCCDB(ccdb.service, run, bc.timestamp(), triggerName[cfgTriggeredData.cfgHighMultiplicityTriggerMenu]);
883+
zorro.populateHistRegistry(registryTrigger, run);
884+
if (!zorro.isSelected(bc.globalBC())) {
885+
return;
886+
}
887+
}
851888
registryQA.fill(HIST("hEventCount"), FilteredEvent);
852889
if (tracks.size() < 1) {
853890
return;
@@ -909,7 +946,9 @@ struct FlowSmallSystems {
909946
}
910947
if (!cfgGFWSettings.cfgEfficiencyNch.value.empty() && weight.hEfficiencyNch != nullptr) {
911948
registryQA.fill(HIST("hMultCorrected_MultUncorrected"), nch, nchCorrected);
949+
registryQA.fill(HIST("hNchCorrected"), nchCorrected);
912950
}
951+
registryQA.fill(HIST("hNch"), nch);
913952
fillOutputObjects(cent, nchCorrCounter, nchCorrected, lRandom, trackCorr);
914953
}
915954
};

0 commit comments

Comments
 (0)