Skip to content

Commit 036a5de

Browse files
committed
[PWGCF] Femto: Apply linter and formatting fixes
1 parent d178ab1 commit 036a5de

8 files changed

Lines changed: 269 additions & 306 deletions

File tree

PWGCF/Femto/Core/charmHadronBuilder.h

Lines changed: 112 additions & 118 deletions
Large diffs are not rendered by default.

PWGCF/Femto/Core/charmHadronHistManager.h

Lines changed: 106 additions & 131 deletions
Large diffs are not rendered by default.

PWGCF/Femto/Core/mcBuilder.h

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "PWGCF/Femto/Core/femtoUtils.h"
2121
#include "PWGCF/Femto/Core/modes.h"
2222
#include "PWGCF/Femto/DataModel/FemtoTables.h"
23+
2324
#include "Common/Core/RecoDecay.h"
2425

2526
#include <CommonConstants/MathConstants.h>
@@ -236,12 +237,12 @@ class McBuilder
236237
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
237238
void fillMcParticle(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, T4& mcProducts)
238239
{
239-
// charm hadrons get a prompt/non-prompt origin (see resolveCharmOrigin), consistent with the
240-
// reco-matched path; all other particles use the generic getOrigin inside getOrCreateMcParticleRow.
240+
// charm hadrons get a prompt/non-prompt origin, consistent with the reco-matched path;
241+
// all other particles use the generic getOrigin inside getOrCreateMcParticleRow
241242
if (std::abs(mcParticle.pdgCode()) == o2::constants::physics::Pdg::kD0) {
242-
// truth-level acceptance for the efficiency denominator
243-
// keep only generated D0 -> K pi decays within the rapidity acceptance.
244-
int8_t sign = 0;
243+
// truth-level acceptance for the efficiency denominator: keep only
244+
// generated D0 -> K pi decays inside the rapidity acceptance
245+
int8_t sign = 0;
245246
if (!RecoDecay::isMatchedMCGen(mcParticles, mcParticle, o2::constants::physics::Pdg::kD0, std::array{+kPiPlus, -kKPlus}, true, &sign)) {
246247
return;
247248
}
@@ -285,11 +286,10 @@ class McBuilder
285286
fillMcLabelGeneric<system>(col, mcCols, k0short, mcParticles, mcProducts, [](auto& prod, int64_t p) { prod.producedK0shortLabels(p); });
286287
}
287288

288-
// D0 has no direct MC label (it is a 2-prong hypothesis built by PWGHF), so we cannot reuse
289-
// fillMcLabelGeneric (which needs has_mcParticle). Instead we match the two prongs to a generated
290-
// D0 -> K pi decay with RecoDecay::getMatchedMCRec, which returns
291-
// the index of the generated mother. If matched, we resolve/create its FMcParticles row and write
292-
// the FD0Labels row; otherwise we write -1.
289+
// D0 has no direct MC label (2-prong hypothesis built by PWGHF), so fillMcLabelGeneric
290+
// cannot be reused. Both prongs are matched to a generated D0 -> K pi decay with
291+
// RecoDecay::getMatchedMCRec, which returns the index of the generated mother;
292+
// unmatched candidates get -1.
293293
template <modes::System system, typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
294294
void fillMcD0WithLabel(T1 const& /*col*/, T2 const& /*mcCols*/, T3 const& d0candidate, T4 const& /*tracks*/, T5 const& mcParticles, T6& mcProducts)
295295
{
@@ -386,15 +386,14 @@ class McBuilder
386386
}
387387

388388
private:
389-
// HF origin: charm hadrons are classified prompt (charm from a c quark) vs non-prompt (charm from
390-
// a beauty decay), resolved from the mc decay tree. Shared by the reco-matched (fillMcD0WithLabel)
391-
// and generator-level (fillMcParticle) paths so both write a consistent origin.
389+
// classify a charm hadron as prompt (charm from a c quark) or non-prompt (charm from a
390+
// beauty decay) from the mc decay tree; shared by the reco-matched and generator-level paths
392391
template <typename T1, typename T2>
393392
modes::McOrigin resolveCharmOrigin(T1 const& mcParticle, T2 const& mcParticles)
394393
{
395394
const int charmOrigin = RecoDecay::getCharmHadronOrigin(mcParticles, mcParticle);
396395
return (charmOrigin == RecoDecay::OriginType::NonPrompt) ? modes::McOrigin::kNonPrompt : modes::McOrigin::kPrompt;
397-
}
396+
}
398397

399398
template <typename T1, typename T2, typename T3>
400399
modes::McOrigin getOrigin(T1 const& col, T2 const& /*mcCols*/, T3 const& mcParticle)
@@ -458,8 +457,8 @@ class McBuilder
458457
return this->buildMcParticleRow<system>(mcParticle, mcParticles, mcCol, origin, mcProducts);
459458
}
460459

461-
/// Origin-injecting entry point: the caller already resolved the origin (e.g. prompt vs non-prompt
462-
/// for a charm hadron, which getOrigin does not classify), so we skip getOrigin and store it directly.
460+
/// \brief Overload for a caller-provided origin, e.g. prompt vs non-prompt for a charm
461+
/// hadron, which getOrigin does not classify; the origin is stored as given
463462
template <modes::System system, typename T1, typename T2, typename T3, typename T4>
464463
int64_t getOrCreateMcParticleRow(T1 const& mcParticle, T2 const& mcParticles, T3 const& mcCol, modes::McOrigin origin, T4& mcProducts)
465464
{

PWGCF/Femto/Core/pairBuilder.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ class PairTrackD0Builder
600600
mTrackCleaner.init(confTrackCleaner);
601601
mD0Cleaner.init(confD0Cleaner);
602602

603-
// PDG codes of the D0 prongs depend on the hypothesis (set via confD0Selection.sign):
603+
// pdg codes of the D0 prongs depend on the hypothesis:
604604
// D0 -> pi+ K- => PosDau = pion, NegDau = kaon
605605
// D0bar -> K+ pi- => PosDau = kaon, NegDau = pion
606606
int posDauPdg = 0;
@@ -691,7 +691,6 @@ class PairTrackD0Builder
691691
}
692692
}
693693

694-
695694
private:
696695
colhistmanager::CollisionHistManager mColHistManager;
697696
trackhistmanager::TrackHistManager<prefixTrack> mTrackHistManager;

PWGCF/Femto/DataModel/FemtoTables.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,7 +1167,7 @@ namespace femtocharmhadrons
11671167
// bitmask column
11681168
DECLARE_SOA_COLUMN(Mask, mask, o2::analysis::femto::datatypes::CharmHadronMaskType); //! selection bitmask
11691169

1170-
// daughter links - row indices into the femto TRACK table
1170+
// daughter links: row indices into the femto track table
11711171
DECLARE_SOA_INDEX_COLUMN_FULL(PosDau, posDau, int32_t, FTracks, "_PosDau"); //! + prong (pion in D0)
11721172
DECLARE_SOA_INDEX_COLUMN_FULL(NegDau, negDau, int32_t, FTracks, "_NegDau"); //! - prong (kaon in D0)
11731173

@@ -1181,14 +1181,14 @@ DECLARE_SOA_COLUMN(DecayLengthXY, decayLengthXY, float);
11811181
DECLARE_SOA_COLUMN(ImpactParameterProduct, impactParameterProduct, float); //! d0*d0 of the two prongs
11821182
DECLARE_SOA_COLUMN(CosThetaStar, cosThetaStar, float);
11831183
// ML BDT scores: [0] background, [1] prompt (D0 from c), [2] non-prompt (D0 from b decay)
1184-
DECLARE_SOA_COLUMN(MlProbD0Bkg, mlProbD0Bkg, float); //! D0 hypothesis: background score
1185-
DECLARE_SOA_COLUMN(MlProbD0Prompt, mlProbD0Prompt, float); //! D0 hypothesis: prompt score
1186-
DECLARE_SOA_COLUMN(MlProbD0NonPrompt, mlProbD0NonPrompt, float); //! D0 hypothesis: non-prompt score
1184+
DECLARE_SOA_COLUMN(MlProbD0Bkg, mlProbD0Bkg, float); //! D0 hypothesis: background score
1185+
DECLARE_SOA_COLUMN(MlProbD0Prompt, mlProbD0Prompt, float); //! D0 hypothesis: prompt score
1186+
DECLARE_SOA_COLUMN(MlProbD0NonPrompt, mlProbD0NonPrompt, float); //! D0 hypothesis: non-prompt score
11871187
DECLARE_SOA_COLUMN(MlProbD0barBkg, mlProbD0barBkg, float); //! D0bar hypothesis: background
11881188
DECLARE_SOA_COLUMN(MlProbD0barPrompt, mlProbD0barPrompt, float); //! D0bar hypothesis: prompt
11891189
DECLARE_SOA_COLUMN(MlProbD0barNonPrompt, mlProbD0barNonPrompt, float); //! D0bar hypothesis: non-prompt
1190-
DECLARE_SOA_COLUMN(IsSelD0, isSelD0, int8_t); //! PWGHF verdict (cross-check)
1191-
DECLARE_SOA_COLUMN(IsSelD0bar, isSelD0bar, int8_t); //! PWGHF verdict (cross-check)
1190+
DECLARE_SOA_COLUMN(IsSelD0, isSelD0, int8_t); //! PWGHF selection flag
1191+
DECLARE_SOA_COLUMN(IsSelD0bar, isSelD0bar, int8_t); //! PWGHF selection flag
11921192
} // namespace femtocharmhadrons
11931193

11941194
DECLARE_SOA_TABLE_STAGED_VERSIONED(FD0s_001, "FD0", 1, //! femto D0/D0bar (kinematics only)
@@ -1216,8 +1216,8 @@ using FD0Masks = FD0Masks_001;
12161216
using StoredFD0Masks = StoredFD0Masks_001;
12171217

12181218
DECLARE_SOA_TABLE_STAGED_VERSIONED(FD0Extras_001, "FD0EXTRA", 1, //! femto D0 QA / debug
1219-
femtocharmhadrons::MassD0, // BOTH hypotheses, always
1220-
femtocharmhadrons::MassD0bar, // (main table only has the accepted one)
1219+
femtocharmhadrons::MassD0, // both hypotheses; the main
1220+
femtocharmhadrons::MassD0bar, // table only stores the accepted one
12211221
femtocharmhadrons::Cpa,
12221222
femtocharmhadrons::CpaXY,
12231223
femtocharmhadrons::DecayLength,
@@ -1230,7 +1230,7 @@ DECLARE_SOA_TABLE_STAGED_VERSIONED(FD0Extras_001, "FD0EXTRA", 1, //! femto D0 QA
12301230
femtocharmhadrons::MlProbD0barBkg,
12311231
femtocharmhadrons::MlProbD0barPrompt,
12321232
femtocharmhadrons::MlProbD0barNonPrompt,
1233-
femtocharmhadrons::IsSelD0, // raw PWGHF verdicts
1233+
femtocharmhadrons::IsSelD0, // raw PWGHF selection flags
12341234
femtocharmhadrons::IsSelD0bar);
12351235
using FD0Extras = FD0Extras_001;
12361236
} // namespace o2::aod

PWGCF/Femto/TableProducer/femtoProducer.cxx

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct FemtoProducer {
116116
v0builder::V0Builder<modes::V0::kLambda, v0builder::LambdaSelHistName, v0builder::LambdaFilterHistName> lambdaBuilder;
117117
v0builder::V0Builder<modes::V0::kAntiLambda, v0builder::AntilambdaSelHistName, v0builder::AntiLambdaFilterHistName> antilambdaBuilder;
118118

119-
// charm hadron builder
119+
// charm hadron builder
120120
charmhadronbuilder::CharmHadronBuilderProducts charmHadronBuilderProducts;
121121
charmhadronbuilder::ConfD0Filters confD0Filters;
122122
charmhadronbuilder::ConfD0Bits confD0Bits;
@@ -206,7 +206,7 @@ struct FemtoProducer {
206206
lambdaBuilder.init(&hRegistry, confLambdaBits, confV0Filters, confV0Tables, context, trackBuilder);
207207
antilambdaBuilder.init(&hRegistry, confLambdaBits, confV0Filters, confV0Tables, context, trackBuilder);
208208

209-
// configure d0 builder
209+
// configure d0 builder
210210
d0Builder.init(&hRegistry, confD0Bits, confD0Filters, confD0Tables, context);
211211
d0barBuilder.init(&hRegistry, confD0Bits, confD0Filters, confD0Tables, context);
212212

@@ -280,7 +280,7 @@ struct FemtoProducer {
280280

281281
// processing D0s
282282
template <modes::System system, typename T1, typename T2, typename T3>
283-
void processD0s(T1 const& col, T2 const& tracks, T3 const& candidates)
283+
void processD0s(T1 const& col, T2 const& tracks, T3 const& candidates)
284284
{
285285
d0Builder.fillD0s<system>(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, charmHadronBuilderProducts, candidates, tracks, trackBuilder);
286286
d0barBuilder.fillD0s<system>(col, collisionBuilder, collisionBuilderProducts, trackBuilderProducts, charmHadronBuilderProducts, candidates, tracks, trackBuilder);
@@ -382,26 +382,28 @@ struct FemtoProducer {
382382

383383
// process tracks and D0s
384384
void processTracksD0sRun3pp(rawinputs::Run3PpCollisions::iterator const& col,
385-
o2::aod::BCsWithTimestamps const& bcs,
386-
rawinputs::Run3FullPidTracks const& tracks,
387-
rawinputs::Run3D0Candidates const& candidates)
385+
o2::aod::BCsWithTimestamps const& bcs,
386+
rawinputs::Run3FullPidTracks const& tracks,
387+
rawinputs::Run3D0Candidates const& candidates)
388388
{
389-
if (!processCollisions<modes::System::kPP_Run3>(col, bcs, tracks)) return;
390-
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3FullPidTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
391-
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracks);
389+
if (!processCollisions<modes::System::kPP_Run3>(col, bcs, tracks))
390+
return;
391+
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3FullPidTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
392+
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracks);
392393
processTracks<modes::System::kPP_Run3>(col, tracksWithItsPid);
393394
processD0s<modes::System::kPP_Run3>(col, tracks, candidates);
394395
}
395396
PROCESS_SWITCH(FemtoProducer, processTracksD0sRun3pp, "Process tracks and D0s", false);
396397

397398
void processTracksD0sRun3PbPb(rawinputs::Run3PbPbCollisions::iterator const& col,
398-
o2::aod::BCsWithTimestamps const& bcs,
399-
rawinputs::Run3FullPidTracks const& tracks,
400-
rawinputs::Run3D0Candidates const& candidates)
399+
o2::aod::BCsWithTimestamps const& bcs,
400+
rawinputs::Run3FullPidTracks const& tracks,
401+
rawinputs::Run3D0Candidates const& candidates)
401402
{
402-
if (!processCollisions<modes::System::kPbPb_Run3>(col, bcs, tracks)) return;
403-
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3FullPidTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
404-
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracks);
403+
if (!processCollisions<modes::System::kPbPb_Run3>(col, bcs, tracks))
404+
return;
405+
auto tracksWithItsPid = o2::soa::Attach<rawinputs::Run3FullPidTracks, o2::aod::pidits::ITSNSigmaEl, o2::aod::pidits::ITSNSigmaPi, o2::aod::pidits::ITSNSigmaKa,
406+
o2::aod::pidits::ITSNSigmaPr, o2::aod::pidits::ITSNSigmaDe, o2::aod::pidits::ITSNSigmaTr, o2::aod::pidits::ITSNSigmaHe>(tracks);
405407
processTracks<modes::System::kPbPb_Run3>(col, tracksWithItsPid);
406408
processD0s<modes::System::kPbPb_Run3>(col, tracks, candidates);
407409
}
@@ -442,7 +444,6 @@ struct FemtoProducer {
442444
}
443445
PROCESS_SWITCH(FemtoProducer, processTracksD0sRun3PbPbMc, "Provide reconstructed and generated tracks and D0s in PbPb collisions", false);
444446

445-
446447
// process tracks and kinks
447448
void processTracksKinksRun3pp(rawinputs::Run3PpCollisions::iterator const& col,
448449
o2::aod::BCsWithTimestamps const& bcs,

PWGCF/Femto/Tasks/femtoD0Qa.cxx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@
1111

1212
/// \file femtoD0Qa.cxx
1313
/// \brief QA task for D0 mesons
14-
/// \author Igor Ptak, WUT, igor.ptak.stud@pw.edu.pl
14+
/// \author Igor Ptak, WUT, igor.tomasz.ptak@cern.ch
1515

16+
#include "PWGCF/Femto/Core/charmHadronBuilder.h"
1617
#include "PWGCF/Femto/Core/charmHadronHistManager.h"
1718
#include "PWGCF/Femto/Core/collisionBuilder.h"
1819
#include "PWGCF/Femto/Core/collisionHistManager.h"
19-
#include "PWGCF/Femto/Core/charmHadronBuilder.h"
2020
#include "PWGCF/Femto/Core/modes.h"
2121
#include "PWGCF/Femto/Core/partitions.h"
2222
#include "PWGCF/Femto/Core/trackHistManager.h"
@@ -45,12 +45,12 @@ struct FemtoD0Qa {
4545
using FilteredFemtoCollisions = o2::soa::Filtered<FemtoCollisions>;
4646
using FilteredFemtoCollision = FilteredFemtoCollisions::iterator;
4747

48-
// D0s joined with mask (partition) and extras (QA columns)
48+
// setup D0s, joined with the mask for the partition and the QA columns
4949
using FemtoD0s = o2::soa::Join<o2::aod::FD0s, o2::aod::FD0Masks, o2::aod::FD0Extras>;
50-
// full-PID tracks so daughter TPC/TOF/PID QA can be booked
50+
// setup tracks with full pid information for the daughter QA
5151
using FemtoTracks = o2::soa::Join<o2::aod::FTracks, o2::aod::FTrackMass, o2::aod::FTrackDcas, o2::aod::FTrackExtras, o2::aod::FTrackPids>;
52-
53-
// MC: same tables joined with their labels (link reco -> generated particle)
52+
53+
// setup monte carlo, joining the labels that link reco to generated particles
5454
using FemtoCollisionsWithLabel = o2::soa::Join<FemtoCollisions, o2::aod::FColLabels>;
5555
using FilteredFemtoCollisionsWithLabel = o2::soa::Filtered<FemtoCollisionsWithLabel>;
5656
using FilteredFemtoCollisionWithLabel = FilteredFemtoCollisionsWithLabel::iterator;
@@ -59,7 +59,6 @@ struct FemtoD0Qa {
5959
using FemtoTracksWithLabel = o2::soa::Join<FemtoTracks, o2::aod::FTrackLabels>;
6060
using FemtoMcParticlesWithLabel = o2::soa::Join<o2::aod::FMcParticles, o2::aod::FMcMotherLabels>;
6161

62-
6362
o2::framework::SliceCache cache;
6463

6564
// setup for collisions
@@ -95,7 +94,7 @@ struct FemtoD0Qa {
9594

9695
o2::framework::HistogramRegistry hRegistry{"FemtoD0Qa", {}, o2::framework::OutputObjHandlingPolicy::AnalysisObject};
9796

98-
void init(o2::framework::InitContext&)
97+
void init(o2::framework::InitContext&)
9998
{
10099
bool processData = doprocessD0;
101100

@@ -151,8 +150,6 @@ struct FemtoD0Qa {
151150
}
152151
}
153152
PROCESS_SWITCH(FemtoD0Qa, processD0Mc, "Process D0s with MC information", false);
154-
155-
156153
};
157154

158155
o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context)
@@ -161,4 +158,4 @@ o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext co
161158
adaptAnalysisTask<FemtoD0Qa>(context),
162159
};
163160
return workflow;
164-
}
161+
}

PWGCF/Femto/Tasks/femtoPairTrackD0.cxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/// \file femtoPairTrackD0.cxx
1313
/// \brief Tasks that computes correlation between tracks and D0 mesons
14-
/// \author Igor Ptak, WUT, igor.ptak.stud@pw.edu.pl
14+
/// \author Igor Ptak, WUT, igor.tomasz.ptak@cern.ch
1515

1616
#include "PWGCF/Femto/Core/charmHadronBuilder.h"
1717
#include "PWGCF/Femto/Core/charmHadronHistManager.h"
@@ -62,7 +62,6 @@ struct FemtoPairTrackD0 {
6262
using FemtoD0sWithLabel = o2::soa::Join<FemtoD0s, o2::aod::FD0Labels>;
6363
using FemtoMcParticlesWithLabel = o2::soa::Join<o2::aod::FMcParticles, o2::aod::FMcMotherLabels>;
6464

65-
6665
o2::framework::SliceCache cache;
6766

6867
// setup collisions
@@ -193,7 +192,6 @@ struct FemtoPairTrackD0 {
193192
pairTrackD0Builder.processMixedEvent<modes::Mode::kMe_Reco_Mc>(cols, mcCols, tracks, trackWithLabelPartition, d0WithLabelPartition, mcParticles, mcMothers, mcPartonicMothers, cache, mixBinsVtxMult, mixBinsVtxCent, mixBinsVtxMultCent);
194193
}
195194
PROCESS_SWITCH(FemtoPairTrackD0, processMixedEventMc, "Enable processing mixed event processing for tracks and D0s with MC information", false);
196-
197195
};
198196

199197
o2::framework::WorkflowSpec defineDataProcessing(o2::framework::ConfigContext const& context)

0 commit comments

Comments
 (0)