Skip to content

Commit f6bc374

Browse files
authored
Merge branch 'AliceO2Group:master' into AddQAhist
2 parents 5a7ef57 + bfeb508 commit f6bc374

12 files changed

Lines changed: 1468 additions & 127 deletions

File tree

.github/workflows/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
steps:
1717
- name: Label the PR
1818
id: labeler
19-
uses: actions/labeler@v6
19+
uses: actions/labeler@v7
2020
with:
2121
repo-token: ${{ secrets.GITHUB_TOKEN }}
2222
sync-labels: true

.github/workflows/mega-linter.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ jobs:
3939
id: ml
4040
# You can override MegaLinter flavor used to have faster performances
4141
# More info at https://megalinter.io/flavors/
42-
uses: oxsecurity/megalinter@v9.6.0
42+
uses: oxsecurity/megalinter@v10.0.0
4343
env:
4444
# All available variables are described in documentation:
4545
# https://megalinter.io/configuration/

.github/workflows/stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
stale:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/stale@v10
16+
- uses: actions/stale@v11
1717
with:
1818
repo-token: ${{ secrets.GITHUB_TOKEN }}
1919
stale-pr-message: 'This PR has not been updated in the last 30 days. Is it still needed? Unless further action is taken, it will be closed in 5 days.'

PWGCF/GenericFramework/Tasks/flowGenericFramework.cxx

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,6 @@ struct FlowGenericFramework {
686686
registryQA.add("trackQA/after/Nch_uncorrected", "; N_{ch}; Counts", {HistType::kTH1D, {nchAxis}});
687687
registryQA.add("trackQA/after/etaNch", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
688688
registryQA.add("trackQA/after/etaPtPt", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
689-
registryQA.add("trackQA/after/etaV02", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
690-
registryQA.add("trackQA/after/etaV0", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
691689
if (!cfgFill.cfgFillRunByRunQA) {
692690
if (cfgUsePID) {
693691
registryQA.add<TH3>("phi_eta_vtxz_ref", "", {HistType::kTH3D, {phiAxis, etaAxis, vtxAxis}});
@@ -732,6 +730,10 @@ struct FlowGenericFramework {
732730
AxisSpec axisLambdaMass = {resoSwitchVals[MassBins][Lambda], resoCutVals[MassMin][Lambda], resoCutVals[MassMax][Lambda]};
733731
AxisSpec yAxis = {100, -1, 1};
734732
// QA histograms for V0s
733+
if (cfgFill.cfgFillV0QA && (resoSwitchVals[UseParticle][K0] != 0 || resoSwitchVals[UseParticle][Lambda] != 0)) {
734+
registryQA.add("trackQA/after/etaV02", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
735+
registryQA.add("trackQA/after/etaV0", "; #eta; Counts", {HistType::kTH1D, {etaAxis}});
736+
}
735737
if (resoSwitchVals[UseParticle][K0] != 0) {
736738
if (cfgFill.cfgFillV0QA) {
737739
registryQA.add("K0/PiPlusTPC_K0", "", {HistType::kTH2D, {{ptAxis, axisNsigmaTPC}}});
@@ -2373,7 +2375,9 @@ struct FlowGenericFramework {
23732375
registryQA.fill(HIST("K0/hK0Count"), FillDaughterTrackSelected);
23742376
selection.selected = true;
23752377
selection.isK0 = true;
2376-
registryQA.fill(HIST("K0/hK0AP"), v0.alpha(), v0.qtarm());
2378+
if (cfgFill.cfgFillV0QA) {
2379+
registryQA.fill(HIST("K0/hK0AP"), v0.alpha(), v0.qtarm());
2380+
}
23772381
return selection;
23782382
}
23792383

@@ -2481,15 +2485,15 @@ struct FlowGenericFramework {
24812485
if (!selectionV0Daughter(postrack, Protons) || !selectionV0Daughter(negtrack, Pions)) {
24822486
return selection;
24832487
}
2484-
if (fillSelectionQA) {
2488+
if (fillSelectionQA && cfgFill.cfgFillV0QA) {
24852489
registryQA.fill(HIST("Lambda/hLambdaAP"), v0.alpha(), v0.qtarm());
24862490
}
24872491
}
24882492
if (selection.isAL) {
24892493
if (!selectionV0Daughter(postrack, Pions) || !selectionV0Daughter(negtrack, Protons)) {
24902494
return selection;
24912495
}
2492-
if (fillSelectionQA) {
2496+
if (fillSelectionQA && cfgFill.cfgFillV0QA) {
24932497
registryQA.fill(HIST("Lambda/hAntiLambdaAP"), v0.alpha(), v0.qtarm());
24942498
}
24952499
}
@@ -2827,11 +2831,15 @@ struct FlowGenericFramework {
28272831

28282832
if (cfgEventSelection.cfgDoOccupancySel) {
28292833
int occupancy = collision.trackOccupancyInTimeRange();
2830-
registryQA.fill(HIST("eventQA/before/occ_mult_cent"), occupancy, tracks.size(), centrality);
2834+
if (cfgFill.cfgFillQA) {
2835+
registryQA.fill(HIST("eventQA/before/occ_mult_cent"), occupancy, tracks.size(), centrality);
2836+
}
28312837
if (occupancy < 0 || occupancy > cfgEventSelection.cfgOccupancySelection) {
28322838
return;
28332839
}
2834-
registryQA.fill(HIST("eventQA/after/occ_mult_cent"), occupancy, tracks.size(), centrality);
2840+
if (cfgFill.cfgFillQA) {
2841+
registryQA.fill(HIST("eventQA/after/occ_mult_cent"), occupancy, tracks.size(), centrality);
2842+
}
28352843
}
28362844
registryQA.fill(HIST("eventQA/eventSel"), 2.5);
28372845
if (cfgFill.cfgFillRunByRunQA) {
@@ -2874,7 +2882,9 @@ struct FlowGenericFramework {
28742882
void processOnTheFly(soa::Filtered<aod::McCollisions>::iterator const& mcCollision, aod::McParticles const& mcParticles, aod::V0Datas const& v0s)
28752883
{
28762884
int run = 0;
2877-
registryQA.fill(HIST("MCGen/impactParameter"), mcCollision.impactParameter(), mcParticles.size());
2885+
if (cfgFill.cfgFillQA) {
2886+
registryQA.fill(HIST("MCGen/impactParameter"), mcCollision.impactParameter(), mcParticles.size());
2887+
}
28782888
processCollision<Gen>(mcCollision, mcParticles, v0s, mcCollision.impactParameter(), -999, run);
28792889
}
28802890
PROCESS_SWITCH(FlowGenericFramework, processOnTheFly, "Process analysis for MC on-the-fly generated events", false);
@@ -3269,7 +3279,9 @@ struct FlowGenericFramework {
32693279
continue;
32703280
}
32713281
fillGeneratedEfficiencyTrack(particle, selectedCentrality);
3272-
fillGeneratedLambdaFeeddownXi(particle, selectedCentrality);
3282+
if (cfgFill.cfgFillV0QA) {
3283+
fillGeneratedLambdaFeeddownXi(particle, selectedCentrality);
3284+
}
32733285
if (isGeneratedEfficiencyV0(particle, PDG_t::kK0Short, K0) && resoSwitchVals[UseParticle][K0] != 0) {
32743286
fillGeneratedEfficiencyV0(particle, EfficiencyK0, selectedCentrality);
32753287
}
@@ -3294,7 +3306,9 @@ struct FlowGenericFramework {
32943306
if (v0.collisionId() != bestCollisionIndex) {
32953307
continue;
32963308
}
3297-
fillLambdaFeeddownReco(v0, collision, tracks, selectedCentrality);
3309+
if (cfgFill.cfgFillV0QA) {
3310+
fillLambdaFeeddownReco(v0, collision, tracks, selectedCentrality);
3311+
}
32983312
fillEfficiencyRecoV0(v0, collision, tracks, selectedCentrality);
32993313
}
33003314
break;

PWGCF/GenericFramework/Tasks/flowGfwNonflow.cxx

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
#include <TF1.h>
4646
#include <TH1.h>
47+
#include <TH2.h>
4748
#include <TH3.h>
4849
#include <TNamed.h>
4950
#include <TObjArray.h>
@@ -78,14 +79,15 @@ struct FlowGfwNonflow {
7879
Configurable<int> cfgMpar{"cfgMpar", 4, "Highest order of pt-pt correlations"};
7980
Configurable<int> cfgCentEstimator{"cfgCentEstimator", 0, "0:FT0C; 1:FT0CVariant1; 2:FT0M; 3:FT0A, 4:NTPV, 5:NGlobal, 6:MFT"};
8081
Configurable<bool> cfgUseNch{"cfgUseNch", false, "Do correlations as function of Nch"};
81-
Configurable<int> cfgUseNchCorrection{"cfgUseNchCorrection", 1, "Use correction for Nch; 0: Use size of tracks table, 1: Use efficiency-corrected Nch values, 2: Use uncorrected Nch values"};
82+
Configurable<int> cfgUseNchCorrection{"cfgUseNchCorrection", 1, "Nch used on the x-axis; 0: tracks table size, 1: efficiency-corrected, 2: accepted reconstructed, 3: Reco.-gen. response-matrix corrected"};
8283
Configurable<bool> cfgRunByRun{"cfgRunByRun", false, "Use run-by-run NUA"};
8384
Configurable<bool> cfgFillQA{"cfgFillQA", false, "Fill QA histograms"};
8485
Configurable<bool> cfgUseCentralMoments{"cfgUseCentralMoments", true, "Use central moments in vn-pt calculations"};
8586
Configurable<bool> cfgUseMultiplicityFlowWeights{"cfgUseMultiplicityFlowWeights", true, "Enable or disable the use of multiplicity-based event weighting"};
8687
struct : ConfigurableGroup {
8788
Configurable<std::string> cfgEfficiencyPath{"cfgEfficiencyPath", "", "CCDB path to efficiency object"};
8889
Configurable<bool> cfgUse2DEfficiency{"cfgUse2DEfficiency", false, "Toggle the use of 2D (pt, centrality) efficiency versus centrality integrated efficiency"};
90+
Configurable<std::string> cfgNchResponsePath{"cfgNchResponsePath", "", "CCDB path to TH2 response matrix (reconstructed Nch on x, generated Nch on y)"};
8991
Configurable<std::string> cfgAcceptancePath{"cfgAcceptancePath", "", "CCDB path to acceptance object"};
9092
} cfgCorrections;
9193
struct : ConfigurableGroup {
@@ -181,6 +183,7 @@ struct FlowGfwNonflow {
181183

182184
struct Config {
183185
TH1* mEfficiency = nullptr;
186+
TH2* mNchResponse = nullptr;
184187
std::vector<GFWWeights*> mAcceptance;
185188
bool correctionsLoaded = false;
186189
} correctionsConfig;
@@ -240,6 +243,12 @@ struct FlowGfwNonflow {
240243
ProtonID,
241244
SpeciesCount
242245
};
246+
enum NchSelector {
247+
TableSize,
248+
Corrected,
249+
Uncorrected,
250+
ResponseMatrixCorrected
251+
};
243252

244253
// Generic Framework
245254
GFW* fGFW = new GFW();
@@ -379,6 +388,9 @@ struct FlowGfwNonflow {
379388
registry.add("eventQA/before/occ_mult_cent", "; occupancy; N_{ch}; centrality (%)", {HistType::kTH3D, {occAxis, nchAxis, centAxis}});
380389
}
381390
}
391+
if (doprocessMCReco) {
392+
registry.add("MCReco/Nch_reco_gen", "; N_{ch}^{reco}; N_{ch}^{gen}", {HistType::kTH2D, {nchAxis, nchAxis}});
393+
}
382394
registry.add("eventQA/before/centrality", "; centrality (%); Counts", {HistType::kTH1D, {centAxis}});
383395
registry.add("eventQA/before/multiplicity", "; N_{ch}; Counts", {HistType::kTH1D, {nchAxis}});
384396
registry.addClone("eventQA/before/", "eventQA/after/");
@@ -639,9 +651,43 @@ struct FlowGfwNonflow {
639651
}
640652
LOGF(info, "Loaded efficiency histogram from %s", cfgCorrections.cfgEfficiencyPath.value.c_str());
641653
}
654+
if (!cfgCorrections.cfgNchResponsePath.value.empty()) {
655+
correctionsConfig.mNchResponse = ccdb->getForTimeStamp<TH2D>(cfgCorrections.cfgNchResponsePath, timestamp);
656+
if (correctionsConfig.mNchResponse == nullptr) {
657+
LOGF(fatal, "Could not load Nch response matrix from %s", cfgCorrections.cfgNchResponsePath.value.c_str());
658+
}
659+
LOGF(info, "Loaded Nch response matrix from %s", cfgCorrections.cfgNchResponsePath.value.c_str());
660+
} else if (cfgUseNchCorrection == NchSelector::ResponseMatrixCorrected) {
661+
LOGF(fatal, "cfgUseNchCorrection=3 requires cfgNchResponsePath");
662+
}
642663
correctionsConfig.correctionsLoaded = true;
643664
}
644665

666+
float getResponseCorrectedNch(const unsigned int multReconstructed) const
667+
{
668+
if (!correctionsConfig.mNchResponse) {
669+
return multReconstructed;
670+
}
671+
const auto* response = correctionsConfig.mNchResponse;
672+
const int recoBin = response->GetXaxis()->FindFixBin(multReconstructed);
673+
if (recoBin < 1 || recoBin > response->GetNbinsX()) {
674+
LOGF(warn, "Reconstructed Nch %u is outside the response matrix; using the uncorrected value", multReconstructed);
675+
return multReconstructed;
676+
}
677+
double sumWeights = 0.;
678+
double sumGeneratedNch = 0.;
679+
for (int genBin = 1; genBin <= response->GetNbinsY(); ++genBin) {
680+
const double weight = response->GetBinContent(recoBin, genBin);
681+
sumWeights += weight;
682+
sumGeneratedNch += weight * response->GetYaxis()->GetBinCenter(genBin);
683+
}
684+
if (sumWeights <= 0.) {
685+
LOGF(warn, "Response matrix has no entries for reconstructed Nch %u; using the uncorrected value", multReconstructed);
686+
return multReconstructed;
687+
}
688+
return sumGeneratedNch / sumWeights;
689+
}
690+
645691
template <typename TTrack>
646692
double getAcceptance(const TTrack& track, const double& vtxz)
647693
{ // 0 ref, 1 ch, 2 pi, 3 ka, 4 pr
@@ -677,22 +723,22 @@ struct FlowGfwNonflow {
677723
return -1.;
678724
}
679725
return 1. / eff;
680-
} else {
681-
auto* effHist = dynamic_cast<TH1D*>(correctionsConfig.mEfficiency);
682-
if (!effHist) {
683-
LOGF(error, "Efficiency object at %s is not a TH1D", cfgCorrections.cfgEfficiencyPath.value.c_str());
684-
return -1.;
685-
}
686-
bin = effHist->FindBin(track.pt());
687-
if (!bin) {
688-
return -1.;
689-
}
690-
const double eff = effHist->GetBinContent(bin);
691-
if (!std::isfinite(eff) || eff <= 0.) {
692-
return -1.;
693-
}
694-
return 1. / eff;
695726
}
727+
728+
auto* effHist = dynamic_cast<TH1D*>(correctionsConfig.mEfficiency);
729+
if (!effHist) {
730+
LOGF(error, "Efficiency object at %s is not a TH1D", cfgCorrections.cfgEfficiencyPath.value.c_str());
731+
return -1.;
732+
}
733+
bin = effHist->FindBin(track.pt());
734+
if (!bin) {
735+
return -1.;
736+
}
737+
const double eff = effHist->GetBinContent(bin);
738+
if (!std::isfinite(eff) || eff <= 0.) {
739+
return -1.;
740+
}
741+
return 1. / eff;
696742
}
697743

698744
template <typename TCollision>
@@ -1014,7 +1060,7 @@ struct FlowGfwNonflow {
10141060
};
10151061

10161062
template <DataType dt, typename TCollision, typename TTracks>
1017-
void processCollision(const TCollision& collision, const TTracks& tracks, const float& centrality, const float& field)
1063+
void processCollision(const TCollision& collision, const TTracks& tracks, const float& centrality, const float& field, const int generatedNch = -1)
10181064
{
10191065
if (tracks.size() < 1) {
10201066
return;
@@ -1037,22 +1083,30 @@ struct FlowGfwNonflow {
10371083
for (const auto& track : tracks) {
10381084
processTrack(track, vtxz, field, centrality, acceptedTracks);
10391085
}
1086+
if constexpr (dt == Reco) {
1087+
if (generatedNch >= 0) {
1088+
registry.fill(HIST("MCReco/Nch_reco_gen"), acceptedTracks.totaluncorr, generatedNch);
1089+
}
1090+
}
10401091
if (dt != Gen && cfgFillQA) {
10411092
registry.fill(HIST("trackQA/after/Nch_corrected"), acceptedTracks.total);
10421093
registry.fill(HIST("trackQA/after/Nch_uncorrected"), acceptedTracks.totaluncorr);
10431094
}
10441095

10451096
float multiplicity = 0.f;
10461097
switch (cfgUseNchCorrection) {
1047-
case 0:
1098+
case NchSelector::TableSize:
10481099
multiplicity = tracks.size();
10491100
break;
1050-
case 1:
1101+
case NchSelector::Corrected:
10511102
multiplicity = acceptedTracks.total;
10521103
break;
1053-
case 2:
1104+
case NchSelector::Uncorrected:
10541105
multiplicity = acceptedTracks.totaluncorr;
10551106
break;
1107+
case NchSelector::ResponseMatrixCorrected:
1108+
multiplicity = (dt == Gen) ? acceptedTracks.totaluncorr : getResponseCorrectedNch(acceptedTracks.totaluncorr);
1109+
break;
10561110
default:
10571111
multiplicity = tracks.size();
10581112
break;
@@ -1155,8 +1209,10 @@ struct FlowGfwNonflow {
11551209

11561210
using GFWCollisions = soa::Filtered<soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNTPVs, aod::CentNGlobals, aod::CentMFTs>>;
11571211
using GFWMCCollisions = soa::Join<aod::Collisions, aod::EvSels, aod::Mults, aod::CentFT0Cs, aod::CentFT0CVariant1s, aod::CentFT0Ms, aod::CentFV0As, aod::CentNTPVs, aod::CentNGlobals, aod::CentMFTs, aod::McCollisionLabels>;
1212+
using FilteredGFWMCCollisions = soa::Filtered<GFWMCCollisions>;
11581213
using GFWTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA>>;
11591214
using GFWMCTracks = soa::Filtered<soa::Join<aod::Tracks, aod::TracksExtra, aod::TrackSelection, aod::TracksDCA, aod::McTrackLabels>>;
1215+
Preslice<aod::McParticles> particlesPerMcCollision = aod::mcparticle::mcCollisionId;
11601216

11611217
SliceCache cache;
11621218
Partition<GFWTracks> posTracks = aod::track::signed1Pt > 0.0f;
@@ -1221,7 +1277,7 @@ struct FlowGfwNonflow {
12211277
}
12221278
PROCESS_SWITCH(FlowGfwNonflow, processData, "Process analysis for non-derived data", true);
12231279

1224-
void processMCReco(GFWCollisions::iterator const& collision, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::McParticles const&)
1280+
void processMCReco(FilteredGFWMCCollisions::iterator const& collision, aod::BCsWithTimestamps const&, GFWMCTracks const& tracks, aod::McParticles const& particles)
12251281
{
12261282
auto bc = collision.bc_as<aod::BCsWithTimestamps>();
12271283
int run = bc.runNumber();
@@ -1265,9 +1321,16 @@ struct FlowGfwNonflow {
12651321
if (cfgFillQA) {
12661322
fillEventQA<After>(collision, tracks);
12671323
}
1324+
unsigned int generatedNch = 0;
1325+
const auto particlesThisCollision = particles.sliceBy(particlesPerMcCollision, collision.mcCollisionId());
1326+
for (const auto& particle : particlesThisCollision) {
1327+
if (particle.isPhysicalPrimary() && particle.eta() > cfgKinematics.cfgEtaNch->first && particle.eta() < cfgKinematics.cfgEtaNch->second && particle.pt() > gfwMemberCache.ptlow && particle.pt() < gfwMemberCache.ptup) {
1328+
++generatedNch;
1329+
}
1330+
}
12681331
loadCorrections(bc);
12691332
auto field = (cfgEventSelection.cfgMagField == DefaultMagneticFieldCut) ? getMagneticField(bc.timestamp()) : static_cast<int>(cfgEventSelection.cfgMagField);
1270-
processCollision<Reco>(collision, tracks, centrality, field);
1333+
processCollision<Reco>(collision, tracks, centrality, field, generatedNch);
12711334
}
12721335
PROCESS_SWITCH(FlowGfwNonflow, processMCReco, "Process analysis for MC reconstructed events", false);
12731336

PWGJE/Tasks/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,10 @@ if(FastJet_FOUND)
444444
SOURCES jetHadronsPid.cxx
445445
PUBLIC_LINK_LIBRARIES O2Physics::AnalysisCore O2Physics::PWGJECore FastJet::FastJet FastJet::Contrib O2Physics::EventFilteringUtils
446446
COMPONENT_NAME Analysis)
447+
o2physics_add_dpl_workflow(jet-hf-ang-substructure
448+
SOURCES jetHFAngularity.cxx
449+
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore
450+
COMPONENT_NAME Analysis)
447451
o2physics_add_dpl_workflow(jet-upc-qa
448452
SOURCES jetUpcQa.cxx
449453
PUBLIC_LINK_LIBRARIES O2::Framework O2Physics::PWGJECore O2Physics::AnalysisCore O2Physics::AnalysisCCDB O2Physics::EventFilteringUtils O2Physics::SGCutParHolder

PWGJE/Tasks/jetDsSpecSubs.cxx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,11 @@ struct JetDsSpecSubs {
565565
// Count all generated MC collisions
566566
registry.fill(HIST("McEffCol"), getValFromBin(BinMCColCntr::All));
567567

568-
// Apply MC vertex selection
568+
// Apply standard event selection and vertex cut
569+
if (!jetderiveddatautilities::selectCollision(mccollision, eventSelectionBits)) {
570+
continue;
571+
}
572+
569573
if (std::abs(mccollision.posZ()) > vertexZCut) {
570574
continue;
571575
}

0 commit comments

Comments
 (0)